#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1000005;
const long long SQRTN = 1003;
const long long LOGN = 22;
const double PI = acos(-1);
const long long INF = 1e16;
const long long MOD = 1000000007;
const long long FMOD = 998244353;
const double eps = 1e-9;
void solvethetestcase();
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long testcase = 1; testcase < t + 1; testcase++) {
    solvethetestcase();
  }
}
long long n;
long long state[1005];
void solvethetestcase() {
  cin >> n;
  long long k = 1;
  for (long long i = 2; i < n + 1; i++) {
    if (n - k - (n + k - 1) / k + 1 < n - i - (n + i - 1) / i + 1) k = i;
  }
  for (long long i = 1; i <= n; i += k) state[i] = -1;
  while (true) {
    vector<long long> v;
    for (long long i = 1; i < n + 1; i++) {
      if (state[i] == 0) v.push_back(i);
      if (((long long)(v).size()) == k) break;
    }
    if (((long long)(v).size()) < k) {
      cout << 0 << endl;
      return;
    }
    cout << k << " ";
    for (auto x : v) {
      cout << x << " ";
      state[x] = 1;
    }
    cout << endl;
    long long q;
    cin >> q;
    for (long long i = q; i < q + k; i++) {
      if (i <= n) {
        if (state[i] == 1) state[i] = 0;
      } else {
        if (state[i - n] == 1) state[i - n] = 0;
      }
    }
  }
}
