s=gets puts ["1","4"].map{|c|->t{l=t.gsub(/\?/,c.to_s).split.map(&:to_i);l.minmax.include?(l[1])?[true,c]:[false,c]}[s]}.map{|c|c[0]?c[1]:""}.join