#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int N;
  cin >> N;
  vector<bool> good(N + 1);
  if (N <= 3) {
    cout << 0;
    exit(0);
  }
  int n = 0, k = 0;
  for (int curk = 2; curk <= N; ++curk) {
    int curn = (double)N - (double)N / curk - (double)curk + 1.;
    if (curn > n) {
      n = curn;
      k = curk;
    }
  }
  set<int> a;
  for (int i = 1; i <= N; ++i)
    if (i % k != 1) a.insert(i), good[i] = true;
  while (a.size() >= k) {
    vector<int> q;
    while (q.size() < k) {
      q.push_back(*a.begin());
      a.erase(a.begin());
    }
    cout << q.size() << ' ';
    for (int i : q) cout << i << ' ';
    cout << endl;
    int s;
    cin >> s;
    for (int i = s, cnt = 0; cnt < q.size(); ++cnt) {
      if (good[i]) a.insert(i);
      ++i;
      if (i > N) i = 1;
    }
  }
  cout << 0 << endl;
}
