#include <bits/stdc++.h>
using namespace std;
const int N = 1004;
int mark[N];
void solve() {
  int n, k, best = 0;
  cin >> n;
  for (int i = (1); i <= (n); ++i) {
    int v = n - ((n + i - 1) / i) - (i - 1);
    if (v > best) best = v, k = i;
  }
  while (best) {
    vector<int> add;
    int cnt = 0;
    for (int i = (0); i <= (n - 1); ++i) {
      if (i % k == 0) continue;
      if (mark[i]) ++cnt;
      if (!mark[i]) {
        mark[i] = 1;
        add.push_back(i + 1);
        if ((int)(add).size() == k) break;
      }
    }
    if (cnt == best) break;
    printf("%d ", (int)(add).size());
    for (int e : add) printf("%d ", e);
    puts("");
    fflush(stdout);
    int second;
    cin >> second;
    if (second == -1) return;
    --second;
    for (int i = (0); i <= (k - 1); ++i) mark[(second + i) % n] = 0;
  }
  cout << 0 << endl;
}
int main() {
  solve();
  return 0;
}
