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

from sys import stdin, stdout
def Q(v):
    print v + 1
    stdout.flush()
    a = stdin.readline().split()
    return a
def A(t):
    print "!"
    for x, y in t:
        print x + 1, y + 1
    stdout.flush()
    quit()

n = int(stdin.readline())
m = (n + 1) / 2
ans = []
d = map(int, Q(0))
p = [0] * 2
for x in d:
    p[x%2] += 1
if p[0] <= m:
    for j, x in enumerate(d):
        if x == 1:
            ans.append((0, j))
    for i in xrange(1, n):
        if d[i] % 2:
            continue
        r = Q(i)
        for j, s in enumerate(r):
            if s == '1':
                ans.append((i, j))
else:
    for i in xrange(1, n):
        if d[i] % 2 == 0:
            continue
        r = Q(i)
        for j, s in enumerate(r):
            if s == '1':
                ans.append((i, j))
A(ans)
