#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 2000000000;
const long long BIG = 1446803456761533460LL;
const int maxn = 1010;
int n, A[maxn];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  int k;
  int mx = 0;
  for (int i = 1; i < n; ++i) {
    int c = n - i - ((n + i - 1) / i - 1);
    if (c > mx) mx = c, k = i;
  }
  while (true) {
    int cnt = 0;
    for (int i = 0; i < n; ++i) cnt += A[i];
    if (cnt >= mx) break;
    cout << k << ' ';
    int kk = k;
    for (int i = 0; i < n; ++i) {
      if (!A[i] && i % k) {
        A[i] = 1;
        cout << i + 1 << ' ';
        if (--kk == 0) break;
      }
    }
    cout << '\n';
    cout.flush();
    int x;
    cin >> x;
    --x;
    for (int i = 0; i < k; ++i) A[(x + i) % n] = 0;
  }
  cout << "0\n";
  cout.flush();
}
