#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
#define int long long
#define all(x) (x).begin(), (x).end()
#define isz(x) (int)x.size()
const int block = 256, MAX = 2e5 + 10, mod = 1e9 + 7, LOG = 20, INF = 1e18;
int a[MAX];
int ask(vector<int> idx) {
cout << isz(idx) << endl;
for (auto &i : idx) cout << i << ' ';
cout << endl;
int ans; cin >> ans;
return ans;
}
void run(int tc) {
int n; cin >> n;
vector<int> idx;
idx.push_back(1);
int last = 1;
a[1] = 1;
for (int i = 2; i <= n; i++) {
idx.push_back(i);
int x = ask(idx);
if (x == isz(idx)) {
a[i] = ++last;
} else {
idx.pop_back();
int low = 0, high = isz(idx) - 1;
auto check = [&](int x) -> bool {
vector<int> cur;
for (int j = isz(idx) - 1; j >= x; j--) cur.push_back(idx[j]);
cur.push_back(i);
return (ask(cur) == isz(cur) - 1);
};
while (low <= high) {
int mid = (low + high) / 2;
if (check(mid)) {
low = mid + 1;
} else {
high = mid - 1;
}
}
a[i] = a[idx[low - 1]];
}
}
cout << 0 << ' ';
for (int i = 1; i <= n; i++) cout << a[i] << ' ';
cout << endl;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t = 1; // cin >> t;
for (int tc = 1; tc <= t; tc++) run(tc);
}