class Sieve: def __init__(self, n): self.plist = [2] min_prime_factor = [2, 0]*(n//2+1) for x in range(3, n+1, 2): if min_prime_factor[x] == 0: min_prime_factor[x] = x self.plist.append(x) if x**2 > n: continue for y in range(x**2, n+1, 2*x): if min_prime_factor[y] == 0: min_prime_factor[y] = x self.min_prime_factor = min_prime_factor def isprime(self, x): return self.min_prime_factor[x] == x def pf(self, x): pp, ee = [], [] while x > 1: mpf = self.min_prime_factor[x] if pp and mpf == pp[-1]: ee[-1] += 1 else: pp.append(mpf) ee.append(1) x //= mpf return pp, ee # unsorted def factor(self, a): ff = [1] pp, ee = self.pf(a) for p, e in zip(pp, ee): ff, gg = [], ff w = p for _ in range(e): for f in gg: ff.append(f*w) w *= p ff += gg return ff from functools import lru_cache @lru_cache(None) def ask(i, j): print("?", i+1, j+1, flush=True) res = int(input()) return res n = int(input()) sv = Sieve(n) p = sv.plist[-1] aa = [0]*n bb = [0]*n for j in range(n):bb[j] = ask(0, j) a0=min(bb) if a0==p: for j in range(n):bb[j]//=p j1=bb.index(1) for i in range(n):aa[i]=ask(i,j1) else: j=0 while bb[j]!=a0*p:j+=1 for i in range(n):aa[i]=ask(i,j)//p i1=aa.index(1) for j in range(n):bb[j]=ask(i1,j) print("!", *aa, *bb, flush=True)