#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(0);
  long long n;
  cin >> n;
  vector<long long> vals;
  for (long long i = (0); i < (n); i++) {
    vals.push_back(0);
  }
  long long kval = 0;
  long long ki = -1;
  for (long long i = (1); i < (n); i++) {
    long long val = n - i - (n + i - 1) / i + 1;
    if (val > kval) {
      kval = val;
      ki = i;
    }
  }
  while (ki != -1) {
    long long tresh = n - n % ki;
    long long sum = 0;
    for (long long i = (0); i < (n); i++) sum += vals[i];
    if (sum == kval) break;
    cout << ki << " ";
    long long col = 0;
    for (long long i = (0); i < (n); i++) {
      if (i % ki == 0) continue;
      if (vals[i] == 0) {
        col++;
        cout << i + 1 << " ";
        vals[i] = 1;
      }
      if (col == ki) break;
    }
    cout << endl;
    long long x;
    cin >> x;
    for (long long i = (0); i < (ki); i++) {
      vals[(x - 1 + i) % n] = 0;
    }
  }
  cout << 0 << endl;
  return 0;
}
