mod = 1000000007 eps = 10**-9 def main(): import sys input = sys.stdin.readline def ask(i, j): print("?", i, j) sys.stdout.flush() N = int(input()) if N == 2: ask(1, 2) p, q = map(int, input().split()) if p == -1: print("!", 2, 3) sys.stdout.flush() else: print("!", 3, 2) sys.stdout.flush() exit() info = [] S = [] for j in range(2, N**2 - N + 1): ask(1, j) p, q = map(int, input().split()) info.append((p, q)) S.append(p+q) s_min = min(S) s_max = max(S) ans = [-1] * (N**2 - N) for j, s in enumerate(S): if s == s_min: j_NN = j if s == s_max: j_10 = j if s_min > 0: j_NN = 0 K = N**2 - 1 x, y = N-1, N-1 ans[0] = N**2 - 1 elif s_max < 0: j_10 = 0 K = N x, y = 1, 0 ans[0] = N else: p, q = info[j_10] a, b = p+1, q if 1 <= a < N and 0 <= b < N: pp = a - (N-1) qq = b - (N-1) if pp > qq: pp, qq = qq, pp if pp == info[j_NN][0] and qq == info[j_NN][1]: x, y = a, b K = x * N + y ans[0] = K else: x, y = q+1, p K = x * N + y ans[0] = K else: x, y = q + 1, p K = x * N + y ans[0] = K j_ask = j_10 x_ask, y_ask = 1, 0 if x - y == 1: j_ask = j_NN x_ask, y_ask = N-1, N-1 seen = {} for j in range(len(info)): if ans[j+1] != -1: continue p, q = info[j] if p*N + q in seen: ans[j+1] = seen[p*N + q] continue a, b = x - p, y - q c, d = x - q, y - p cand = [] if 1 <= a < N and 0 <= b < N: cand.append((a, b)) if 1 <= c < N and 0 <= d < N: cand.append((c, d)) if len(cand) == 1: ans[j+1] = cand[0][0] * N + cand[0][1] else: ask(j+1, j_ask+1) p_new, q_new = map(int, input().split()) pp, qq = a - x_ask, b - x_ask if pp > qq: pp, qq = qq, pp if pp == p_new and qq == q_new: ans[j+1] = a*N + b seen[p*N + q] = c*N + d else: ans[j+1] = c*N + d seen[p*N + q] = a*N + b ans = ["!"] + ans print(*ans) sys.stdout.flush() if __name__ == '__main__': main()