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

n = int(input())
print('?', 1)
Ans = []
A = list(map(int, input().split()))
B1 = []
B2 = []
for i in range(n):
    if A[i] % 2 == 0 and A[i] != 0:
        B1.append(i)
    else:
        B2.append(i)
if len(B1) <= len(B2):
    for i in range(len(A)):
        if A[i] == 1:
            Ans.append((1, i + 1))
    for i in range(len(B1)):
        print('?', B1[i] + 1)
        A = list(map(int, input().split()))
        for j in range(len(A)):
            if A[j] == 1:
                Ans.append((i + 1, j + 1))
else:
    for i in range(len(B2)):
        print('?', B2[i] + 1)
        A = list(map(int, input().split()))
        for j in range(len(A)):
            if A[j] == 1:
                Ans.append((i + 1, j + 1))
for i in range(len(Ans)):
    print(*Ans[i])