#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  pair<int, int> best;
  int n;
  cin >> n;
  for (int i = 2; i <= n; i++) {
    int vl = (i - 1) * (n / i - 1);
    if ((n % i) > 1) {
      vl += n % i - 1;
    }
    best = max(best, make_pair(vl, i));
  }
  int cur = 0;
  vector<bool> on(n + 1);
  for (;;) {
    if (cur >= best.first) {
      cout << 0 << endl;
      exit(0);
    } else {
      vector<int> kek;
      for (int i = 1; i <= n; i++) {
        if (i % best.second == 0) {
          continue;
        }
        if (!on[i] && (int)(kek).size() < best.second) {
          kek.push_back(i);
          on[i] = true;
        }
      }
      cout << (int)(kek).size();
      for (int id : kek) {
        cout << ' ' << id;
        cur++;
      }
      cout << endl;
      int pos;
      cin >> pos;
      for (int i = 0; i < (int)(kek).size(); i++) {
        if (on[pos]) {
          cur--;
          on[pos] = false;
        }
        if (pos == n) {
          pos = 1;
        } else {
          pos++;
        }
      }
    }
  }
}
