#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } unsigned long long xor64() { static unsigned long long x = (unsigned long long)(chrono::duration_cast( chrono::high_resolution_clock::now().time_since_epoch()).count()) * 10150724397891781847ULL; x ^= x << 7; return x ^= x >> 9; } array,400> T; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for(int i = 0; i < n; i++) T[i].fill(1); vector ord(n); iota(ord.begin(), ord.end(), 0); constexpr int BL = 20; int Q = 4500; while(Q >= 1){ for(int i = 1; i < n; i++) swap(ord[i], ord[xor64() % n]); for(int i = 0; i < n && Q >= 1; i += BL){ Q--; int l = i, r = min(n, i + BL); if(r - l <= 1) break; int mid = (l + r) / 2; vector a, b; for(int j = l; j < r; j++){ if(j < mid) a.emplace_back(ord[j] + 1); else b.emplace_back(ord[j] + 1); } int res; cout << "? " << a.size() << " " << b.size() << " " << a << " " << b << endl; cin >> res; if(res == 0){ for(auto u : a){ for(auto v : b){ T[u - 1][v - 1] = T[v - 1][u - 1] = 0; } } } } } vector> ans; for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ if(T[i][j] == 1) ans.emplace_back(i + 1, j + 1); } } cout << "! " << ans.size() << endl; for(auto [u, v] : ans) cout << u << " " << v << '\n'; cout << endl; }