#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  if (n <= 3) {
    cout << 0 << endl;
    cout.flush();
    return 0;
  }
  vector<char> lit(n);
  int k = 2;
  for (int t = 3; t < n; ++t) {
    if (n - t - n / t - !!(n % t) > n - k - n / k - !!(n % k)) {
      k = t;
    }
  }
  int px = 0;
  for (int iter = 0; iter < 10000; ++iter) {
    vector<int> req;
    req.reserve(k);
    for (int i = px; i < px + k; ++i) {
      if ((i % n) % k) {
        lit[i % n] = 1;
        req.emplace_back(i % n);
      }
    }
    bool done = true;
    for (int i = 0; i < n; ++i) {
      if (!lit[i] && i % k) {
        lit[i] = 1;
        req.emplace_back(i);
        done = false;
        break;
      }
    }
    if (done) {
      break;
    }
    cout << req.size() << endl;
    for (auto e : req) {
      cout << e + 1 << ' ';
    }
    cout << endl;
    cout.flush();
    int x;
    cin >> x;
    if (x == -1) {
      return 0;
    }
    px = x - 1;
  }
  cout << 0 << endl;
  cout.flush();
  return 0;
}
