#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int targ = 0, bsz = 1;
  for (int z = 2; z <= n; z++) {
    int ntarg = (n / z) * (z - 1) + max(0, n % z - 1) - (z - 1);
    if (ntarg >= targ) {
      targ = ntarg;
      bsz = z;
    } else
      break;
  }
  bool filled[2000] = {};
  for (int z = 0; z < targ; z++) {
    vector<int> idxs;
    for (int i = 0; i < n; i++) {
      if (i % bsz == bsz - 1) continue;
      if (filled[i]) continue;
      idxs.push_back(i);
      filled[i] = true;
      if (idxs.size() == bsz) break;
    }
    cout << idxs.size();
    for (auto idx : idxs) cout << ' ' << idx + 1;
    cout << endl;
    int resp;
    cin >> resp;
    if (resp == -1) {
      cout << "UH OH resp=-1\n";
      return -1;
    }
    for (int i = 0; i < bsz; i++) filled[(resp - 1 + i) % n] = false;
  }
  cout << "0" << endl;
}
