#include <bits/stdc++.h>
using namespace std;
const long long Mod = 1000000007LL;
const int N = 1e3 + 10;
const long long Inf = 2242545357980376863LL;
const long long Log = 30;
long long n;
int mk[N];
long long k;
void Op() {
  long long x;
  cin >> x;
  int wh = x;
  for (int i = 0; i < k; i++) {
    mk[wh] = 0;
    wh++;
    if (wh == n + 1) wh = 1;
  }
}
vector<long long> V, Gd;
long long K;
void Move() {
  V.clear();
  for (auto i : Gd) {
    if (!mk[i]) V.push_back(i);
  }
  k = V.size();
  if (k <= K) {
    cout << "0" << endl;
    exit(0);
  }
  cout << k << '\n';
  for (auto x : V) {
    cout << x << ' ';
    mk[x] = 1;
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  if (n < 4) {
    cout << "0" << endl;
    return 0;
  }
  long long ans = n / 2 - 1;
  K = 1;
  for (int i = 2; i <= n; i++) {
    long long t = n / (i + 1);
    if (t <= 1) continue;
    long long C = ((t - 1) * i) + max(0ll, (n % (i + 1)) - 1);
    if (C > ans) {
      K = i;
      ans = C;
    }
  }
  for (int i = 1; i <= n; i += K + 1) {
    for (int j = i; j < i + K; j++) {
      if (j >= n) break;
      Gd.push_back(j);
    }
  }
  while (true) {
    Move();
    Op();
  }
  return 0;
}
