5
5 3
2 4
3 1
4 5
 4
2 4
3 2
2 1
 5
5 3
2 4
3 1
4 5
 2
1 2
 4
3 4
2 3
3 1
 10
8 10
2 9
7 8
4 1
7 3
4 7
2 5
2 4
4 6
 5
3 4
3 2
3 1
1 5
 3
1 2
2 3
 5
1 2
1 3
1 4
1 5

1 2
2 3
2 4
 1 3
2 4
3 5
4 5
 1 2
 1 3
2 3
3 4
 1 4
2 4
2 5
2 9
3 7
4 6
4 7
7 8
8 10
 1 3
1 5
2 3
3 4
 1 2
2 3
 1 2
1 3
1 4
1 5

# Library Imports
from math import sqrt,ceil,floor
import sys
from collections import Counter,deque
from collections import defaultdict as dd


# Debug Function
# def variablename(variable):
#     for name in globals():
#         if eval(name) == variable:
#             return name
# def debug(x):
#     print(f"{variablename(x)}={x}")



# Code Here
mod=10**9+7
def modexp(a,b):
    if b==0:
        return 1
    if b%2:
        return (a*((modexp(a,b//2)%mod)**2)%mod)%mod
    return ((modexp(a,b//2)%mod)**2)%mod





n=int(input())
# n,m=map(int,input().split())
done=[0]*(n+1)
edges=set()
i=1
while(i<n):
    if done[i]:
        i+=1
        continue
    print('?',i)
    arr=list(map(int,input().split()))
    for j in range(n):
        if arr[j]==1:
            # print('edge',[i,j+1])
            edges.add(frozenset([i,j+1]))
            done[i]=1
            done[j]=1
    i+=1
for edge in edges:
    print(*edge)
    
    
    
    
    
    