#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  int best = -1;
  int k = 1;
  for (int i = 1; i <= n; i++) {
    int now = (n / i - 1) * (i - 1);
    int now2 = n / i;
    if (n % i != 0) {
      now2++;
    }
    now2 = n - (now2) - (i - 1);
    if (now2 > best) {
      best = now2;
      k = i;
    }
  }
  vector<bool> ig(n);
  vector<bool> on(n);
  for (int i = 0; i < n; i += k) {
    ig[i] = true;
  }
  vector<int> rem;
  for (int z = 0; z < n; z++) {
    rem.clear();
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (on[i]) {
        cnt++;
      }
    }
    if (cnt == best) {
      break;
    }
    for (int i = 0; i < n; i++) {
      if (!ig[i] && !on[i]) {
        rem.push_back(i);
      }
    }
    if (rem.size() == 0) {
      cout << 0 << endl;
      return 0;
    }
    while (rem.size() > k) {
      rem.pop_back();
    }
    for (int i = 0; i < n && rem.size() < k; i++) {
      if (ig[i] && !on[i]) {
        rem.push_back(i);
      }
    }
    cout << rem.size();
    for (int i = 0; i < rem.size(); i++) {
      on[rem[i]] = true;
      cout << " " << (rem[i] + 1);
    }
    cout << endl;
    int x;
    cin >> x;
    if (x == -1) {
      return 0;
    }
    x--;
    for (int i = 0; i < rem.size(); i++) {
      int ind = (x + i) % n;
      on[ind] = false;
    }
  }
  cout << 0 << endl;
}
