#include <bits/stdc++.h>
using namespace std;
const int NN = 1010;
int fl[NN], a[NN];
int n, N;
int ask() {
  int nn = 0;
  for (int i = 1; i <= n; i++)
    if (fl[i] and !a[i]) nn++;
  int k = min(nn, N);
  printf("%d", k);
  for (int i = 1; i <= n; i++) {
    if (!fl[i]) continue;
    if (!a[i]) a[i] = 1, k--, printf(" %d", i);
    if (!k) break;
  }
  puts("");
  int t;
  fflush(stdout);
  scanf("%d", &t);
  if (nn <= N) {
    puts("0");
    exit(0);
  }
  return t;
}
int fun(int u) {
  int ans = (u - 1) * (n / u - 1) + max(n % u - 1, 0);
  return ans;
}
int main() {
  scanf("%d", &n);
  if (n < 4) {
    puts("0");
    return 0;
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    if (fun(i) > ans) {
      ans = fun(i);
      N = i;
    }
  }
  for (int i = 1; i < n; i++)
    if (i % N) fl[i] = 1;
  while (1) {
    int r = ask();
    for (int i = r; i < r + N; i++) {
      if (i > n)
        a[i - n] = 0;
      else
        a[i] = 0;
    }
  }
  return 0;
}
