#include <bits/stdc++.h>
using namespace std;
long long n, k, mx = 0, pos;
long long a[200005];
vector<long long> v;
int main() {
  cin >> n;
  if (n <= 3) {
    cout << 0 << endl;
    return 0;
  }
  for (long long i = 1; i <= n; i++) {
    if (n - i - (n - 1) / i > mx) {
      mx = n - i - (n - 1) / i;
      k = i;
    }
  }
  while (1) {
    v.clear();
    for (long long j = 0, i = 1; i <= n; i++) {
      if (i % k == 1 || a[i]) continue;
      j++;
      v.push_back(i);
      a[i] = 1;
      if (j == k) break;
    }
    if ((long long)v.size() < k) {
      cout << 0 << endl;
      break;
    }
    cout << k;
    for (long long i = 0; i < v.size(); i++) cout << ' ' << v[i];
    cout << endl;
    cin >> pos;
    for (long long i = pos; i <= pos + k - 1; i++) {
      if (i > n)
        a[i - n] = 0;
      else
        a[i] = 0;
    }
  }
  return 0;
}
