#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') f = -1;
  for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
  return x * f;
}
const int MAXN = 100010;
const int INF = 2147483600;
int N;
int sta[MAXN + 1], top;
bool chs[MAXN + 1], On[MAXN + 1];
int main() {
  N = read();
  int res = -1, len = 0;
  if (N == 1) {
    puts("0");
    fflush(stdout);
    return 0;
  }
  for (int i = 1; i <= N; i++) {
    int d = (N / (i + 1)) * i + max(N % (i + 1) - 1, 0) - i;
    if (d > res) {
      res = d;
      len = i;
    }
  }
  for (int i = 1; i <= N; i++) {
    if (i <= (N / (len + 1)) * (len + 1)) {
      if ((i - 1) % (len + 1) < len) chs[i] = 1;
    } else {
      if (i != N) chs[i] = 1;
    }
  }
  for (int i = 1; i <= N; i++) On[i] = 0;
  int tms = 0;
  while (tms <= 1000) {
    int top = 0, num = 0;
    ++tms;
    for (int i = 1; i <= N; i++) {
      if (chs[i] ^ On[i]) {
        sta[++top] = i;
        On[i] = 1;
        ++num;
      }
    }
    printf("%d ", top);
    for (int i = 1; i <= top; i++) printf("%d ", sta[i]);
    puts("");
    fflush(stdout);
    int x;
    scanf("%d", &x);
    for (int i = 1; i <= top; i++) {
      if (On[x]) --num;
      On[x] = 0;
      ++x;
      if (x == N + 1) x = 1;
    }
    if (!num) {
      puts("0");
      fflush(stdout);
      return 0;
    }
  }
  return 0;
}
