#include <bits/stdc++.h>
using namespace std;
int n;
int a[5001];
int b[5001];
int c[5001];
int per;
vector<int> sol;
void ask() {
  sol.clear();
  for (int i = 1; i <= n; i++)
    if (b[i]) sol.push_back(i);
  printf("%d", sol.size());
  for (int i = 0; i < sol.size(); i++) printf(" %d", sol[i]);
  puts("");
  fflush(stdout);
  int k;
  scanf("%d", &k);
  for (int i = 1; i <= n; i++)
    if (b[i]) a[i] = 1;
  for (int ty = 1; ty <= sol.size(); ty++) {
    a[k] = 0;
    k = (k % n) + 1;
  }
}
void fill() {
  for (int i = 1; i <= n; i++) b[i] = 0;
  int tot = 0;
  for (int i = 1; i <= n; i++)
    if (c[i] && !a[i]) {
      b[i] = 1;
      tot++;
      if (tot == per) return;
    }
}
int main() {
  scanf("%d", &n);
  int best = 0;
  for (int i = 1; i <= n; i++) {
    int local = (n / i - 1) * (i - 1) + max(0, n % i - 1);
    if (local > best) {
      best = local;
      per = i;
    }
  }
  if (per == 0) {
    puts("0");
    fflush(stdout);
    return 0;
  }
  for (int i = 1; i <= n - 1; i++) {
    if (i % per != 0) {
      c[i] = 1;
    }
  }
  while (true) {
    fill();
    int cnt = 0;
    for (int i = 1; i <= n; i++)
      if (b[i]) cnt++;
    if (cnt < per) {
      printf("0\n");
      fflush(stdout);
      return 0;
    }
    ask();
  }
}
