N = gets.to_i omori = [*1..N] def send_query(i, j) query = Array.new(2 * N, 0) query[0] = i query[1] = j STDOUT.puts("? #{query.join(' ')}") STDOUT.flush STDERR.puts("? #{query.join(' ')}") res = gets.chomp.split res[0] == '<' ? -1 : 1 end omori.sort! { |i, j| send_query(i, j) } puts "! #{omori.join(' ')}"