#include <bits/stdc++.h>
using namespace std;
int n;
int R(int K) { return (n - 1) / (K + 1) + 1 + K; }
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int K = sqrt(n);
  if (R(K + 1) < R(K) && R(K + 1) < R(K - 1)) K = K + 1;
  if (R(K - 1) < R(K) && R(K - 1) < R(K + 1)) K = K - 1;
  vector<int> lamp(n);
  int cnt = 0;
  while (n - cnt > R(K)) {
    vector<int> l;
    for (int i = 0; i < n - 1; ++i) {
      if (!lamp[i] && (i + 1) % (K + 1) != 0) {
        l.push_back(i);
        if ((int)l.size() == K + 1) break;
      }
    }
    int k = l.size();
    cout << k << ' ';
    for (int i : l) {
      cout << i + 1 << ' ';
      lamp[i] = 1;
      cnt++;
    }
    cout << endl;
    int x;
    cin >> x;
    x--;
    for (int i = 0; i < k; ++i) {
      if (lamp[(x + i) % n]) cnt--;
      lamp[(x + i) % n] = 0;
    }
  }
  cout << 0 << endl;
}
