#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
bool mark[N];
signed main() {
  int n;
  cin >> n;
  if (n <= 3) {
    cout << "0" << endl;
    return 0;
  }
  int mn = 1e9, k = -1;
  for (int i = 2; i <= n; i++) {
    int cur = (n + i - 1) / i + i;
    if (cur < mn) {
      mn = cur;
      k = i;
    }
  }
  cerr << k << "\n";
  int cur = 0;
  while (cur <= n - (n + k - 1) / k - k) {
    vector<int> v;
    for (int i = 0; i < n && v.size() < k; i++)
      if (i % k != 0 && !mark[i]) {
        v.push_back(i);
        mark[i] = true;
        cur++;
      }
    cout << v.size() << " ";
    for (auto i : v) cout << i + 1 << " ";
    cout << endl;
    int x;
    cin >> x;
    x--;
    if (x < 0) exit(0);
    for (int i = x; i != (x + v.size()) % n; i = (i + 1) % n) {
      cur -= mark[i];
      mark[i] = false;
    }
  }
  cout << "0" << endl;
  return 0;
}
