from math import lcm, gcd import random def main(): N = int(input()) A = [-1 for _ in range(N)] B = [-1 for _ in range(N)] res = [[-1 for _ in range(N)] for __ in range(N)] b_lcm_azero = [] r = random.randint(0, N - 1) for i in range(N): print("? {} {}".format(r + 1, i + 1), flush=True) x = int(input()) b_lcm_azero.append(x) res[r][i] = x a_r = min(b_lcm_azero) A[r] = a_r b_one_cand = [] for i in range(N): if b_lcm_azero[i] == a_r: b_one_cand.append(i) cand = [i for i in range(N)] random.shuffle(cand) for i in range(N): r = cand[i] if A[r] != -1: continue values = [] for c in b_one_cand: print("? {} {}".format(r + 1, c + 1), flush=True) x = int(input()) values.append(x) res[r][c] = x b_one_cand_nxt = [] m = min(values) A[r] = m for j in range(len(b_one_cand)): if values[j] == m: b_one_cand_nxt.append(b_one_cand[j]) b_one_cand = b_one_cand_nxt if len(b_one_cand) == 1: break j = b_one_cand[0] B[j] = 1 for i in range(N): if A[i] != -1: continue if res[i][j] != -1: A[i] = res[i][j] continue print("? {} {}".format(i + 1, j + 1), flush=True) x = int(input()) res[i][j] = x A[i] = x j = -1 for i in range(N): if A[i] == 1: j = i for i in range(N): if B[i] != -1: continue if res[j][i] != -1: B[i] = res[j][i] continue print("? {} {}".format(j + 1, i + 1), flush=True) x = int(input()) B[i] = x res[j][i] = x print("!", *A, *B, flush=True) main()