#include <bits/stdc++.h>
using namespace std;
int n, opt, pos[1005], k, val;
bool check(int i) { return i % k == 0; }
void change(int cnt) {
  int x;
  scanf("%d", &x);
  x--;
  for (int i = x; i <= x + cnt - 1; i++) {
    pos[i % n] = 0;
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 2; i <= n; i++) {
    int cur = n - i + 1 - ((n + i - 1) / i);
    if (cur > val) val = cur, k = i;
  }
  opt = val;
  while (1) {
    int cnt = 0;
    for (int i = 1; i <= n; i++) cnt += pos[i];
    if (cnt >= opt) {
      printf("0\n");
      fflush(stdout);
      return 0;
    }
    vector<int> cur;
    for (int i = 0; i <= n - 1; i++) {
      if (check(i) || pos[i]) continue;
      cur.push_back(i + 1);
    }
    for (auto x : cur) pos[x - 1] = 1;
    printf("%d ", ((int)cur.size()));
    for (auto x : cur) printf("%d ", x);
    printf("\n");
    fflush(stdout);
    change(((int)cur.size()));
  }
  return 0;
}
