#include <bits/stdc++.h>
using namespace std;
const int N = 1e3 + 5;
int State[N], Target[N];
int n;
int turnOn() {
  vector<int> vec;
  for (int i = 0; i < n; i++)
    if (Target[i] > State[i]) {
      State[i] = 1;
      vec.push_back(i);
    }
  int k = vec.size();
  printf("%d ", k);
  for (int v : vec) printf("%d ", v + 1);
  printf("\n");
  fflush(stdout);
  return k;
}
void read(int k) {
  int x;
  scanf("%d", &x);
  if (x == -1) exit(0);
  x--;
  for (int i = 0; i < k; i++) {
    State[(x + i) % n] = 0;
  }
}
void finish() {
  printf("0\n");
  exit(0);
}
int main() {
  scanf("%d", &n);
  int myK = 0;
  int best = 0;
  for (int ck = 1; ck < n + 1; ck++) {
    int res = 0;
    for (int i = 0; i < n - 1; i++)
      if (i % ck < ck - 1) res++;
    res = max(0, res - ck + 1);
    if (res > best) {
      best = res;
      myK = ck;
    }
  }
  fprintf(stderr, "my best is %d\n", best);
  if (best == 0) finish();
  for (int i = 0; i < n - 1; i++)
    if (i % myK < myK - 1) Target[i] = 1;
  for (;;) {
    int cnt = 0;
    for (int i = 0; i < n; i++) cnt += State[i];
    if (cnt >= best) finish();
    int k = turnOn();
    if (k == 0) break;
    read(k);
  }
}
