#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cout.tie(0), cin.tie(0);
  int n;
  cin >> n;
  if (n <= 3) {
    cout << 0 << '\n';
    return 0;
  }
  int Max = -1, k;
  for (int i = 2; i < n; ++i) {
    int tp = n / i * (i - 1);
    if (n % i >= 1) tp += n % i - 1;
    tp -= i - 1;
    if (tp > Max) Max = tp, k = i;
  }
  set<int> Se;
  vector<int> SS(n);
  int a = n / k, ps = 0;
  for (int i = 0; i < a; ++i) {
    for (int j = 0; j < k; ++j) {
      if (j == k - 1)
        ps++;
      else
        Se.insert(ps++);
    }
  }
  for (; ps < n - 1; ++ps) Se.insert(ps);
  for (int i : Se) SS[i] = 1;
  bool ok = 0;
  while (!ok) {
    vector<int> A;
    for (int i = 0; i < k; ++i)
      if (((int)(Se).size())) {
        A.push_back(*Se.begin());
        Se.erase(Se.begin());
      }
    if (((int)(Se).size()) == 0) ok = 1;
    cout << ((int)(A).size()) << ' ';
    for (int i : A) cout << i + 1 << " ";
    cout << endl;
    cout.flush();
    int l;
    cin >> l;
    --l;
    for (int i = 0; i < k; ++i) {
      if (SS[(i + l) % n]) Se.insert((i + l) % n);
    }
    if (ok) {
      cout << 0 << endl;
      cout.flush();
    }
  }
  return 0;
}
