#include <bits/stdc++.h>
using namespace std;
long long int const mod = 998244353;
std::mt19937 rng(
    (int)std::chrono::steady_clock::now().time_since_epoch().count());
int rand_rng(int l, int r) {
  uniform_int_distribution<int> p(l, r);
  return p(rng);
}
int arr1[100009];
int parent[100009];
vector<long long int> sieve;
void sievefun(long long int n) {
  for (long long int i = 2; i <= n; i++) {
    if (arr1[i] == 0) {
      parent[i] = i;
      for (long long int j = i * i; j <= n; j += i) {
        if (arr1[j] == 0) parent[j] = i;
        arr1[j] = 1;
      }
    }
  }
}
long long int power(long long int x, long long int y, long long int m) {
  long long int temp;
  if (y == 0 || x == 1) return 1;
  temp = power(x, y / 2, m) % m;
  if (y % 2 == 0)
    return ((temp) * (temp)) % m;
  else
    return (((x) % m) * ((temp * temp) % m)) % m;
}
int const N = 200009;
int main() {
  int n, x, y;
  cin >> n;
  set<long long int> st, on, off;
  int ind = 1;
  if (n <= 3) {
    cout << 0 << endl;
    return 0;
  }
  long long int num = 0;
  ind = 0;
  for (int i = 1; i <= n; i++) {
    if (n - i + 1 - ((n + i - 1) / i) > num) {
      num = n - i + 1 - ((n + i - 1) / i);
      ind = i;
    }
  }
  for (int i = 1; i <= n; i++) {
    if ((i - 1) % (ind) == 0) continue;
    off.insert(i);
  }
  while (off.size() >= ind) {
    vector<long long int> out;
    for (int i = 0; i < (int)ind; i++) {
      out.push_back(*(off.begin()));
      on.insert(*(off.begin()));
      off.erase(*(off.begin()));
    }
    cout << out.size() << " ";
    for (auto i : out) cout << i << " ";
    cout << endl;
    cin >> x;
    for (int i = 0; i < (int)ind; i++) {
      if (on.find(x) != on.end()) {
        on.erase(x);
        off.insert(x);
      }
      x++;
      if (x > n) x -= n;
    }
  }
  cout << 0 << endl;
}
