N = gets.to_i sum = (1..N).sum def send_query(l, r) STDOUT.puts("? #{l} #{r}") STDOUT.flush gets.to_i end arr = [] (N - 1).times do |i| if i == N - 2 res = send_query(2, N) arr << (1..N).sum - res sum -= arr.last else res = send_query(1, N - i - 1) arr << sum - res sum -= arr.last end end arr << sum STDOUT.puts("! #{arr.reverse.join(' ')}") STDOUT.puts