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

#include <bits/stdc++.h>
using namespace std;
int arr[2005][2005];
vector<pair<int, int> > v;
map<pair<int, int>, int> m;
int main() {
  int n, cnt = 0;
  cin >> n;
  cout << "? 1\n";
  fflush(stdout);
  for (int i = 0; i < n; i++) {
    cin >> arr[0][i];
    cnt += (arr[0][i] % 2 == 0);
  }
  if (cnt <= n / 2) {
    for (int i = 1; i < n; i++) {
      if (arr[0][i] % 2) continue;
      cout << "? " << i + 1 << "\n";
      fflush(stdout);
      for (int j = 0; j < n; j++) {
        cin >> arr[i][j];
        if (arr[i][j] == 1 && !m[make_pair(i, j)]) {
          m[make_pair(i, j)] = 1;
          v.push_back(make_pair(i + 1, j + 1));
        }
      }
    }
  } else {
    for (int i = 1; i < n; i++) {
      if (arr[0][i] % 2 == 0) continue;
      cout << "? " << i + 1 << "\n";
      fflush(stdout);
      for (int j = 0; j < n; j++) {
        cin >> arr[i][j];
        if (arr[i][j] == 1 && !m[make_pair(i, j)]) {
          m[make_pair(i, j)] = 1;
          v.push_back(make_pair(i + 1, j + 1));
        }
      }
    }
  }
  cout << "!\n";
  fflush(stdout);
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << "\n";
    fflush(stdout);
  }
  return 0;
}
