#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long res;
  scanf("%lld", &res);
  return res;
}
long long n, a[10005], cnt;
bool vis[10005];
signed main() {
  n = read();
  if (n <= 3) {
    puts("0");
    fflush(stdout);
    return 0;
  }
  long long x = 1;
  while (x * x < n) x++;
  for (long long i = 1; i <= n; i++)
    if ((i - 1) % x) a[++cnt] = i;
  while (1) {
    printf("%lld", x);
    for (long long i = 1; i <= x; i++)
      printf(" %lld", a[cnt]), vis[a[cnt]] = 1, cnt--;
    puts("");
    fflush(stdout);
    long long y = read();
    for (long long i = 0; i < x; i++)
      if (vis[(y + i - 1) % n + 1])
        a[++cnt] = (y + i - 1) % n + 1, vis[(y + i - 1) % n + 1] = 0;
    if (x > cnt) break;
  }
  puts("0");
  fflush(stdout);
  return 0;
}
