#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
bool good[N], need[N];
int n;
void ask(vector<int> &v) {
  printf("%d", (int)v.size());
  for (int i = 0; i < (int)v.size(); i++) {
    printf(" %d", v[i]);
    good[v[i]] = true;
  }
  puts("");
  fflush(stdout);
  int idx;
  scanf("%d", &idx);
  for (int i = 0; i < (int)v.size(); i++) {
    good[idx] = false;
    idx++;
    if (idx > n) idx = 1;
  }
}
int main() {
  scanf("%d", &n);
  if (n <= 3) {
    puts("0");
    fflush(stdout);
    return 0;
  }
  int cur, best = 0, k;
  for (int sz = 1; sz < n; sz++) {
    cur = ((n + sz) / (sz + 1));
    cur = n - cur - sz;
    if (cur > best) {
      best = cur;
      k = sz;
    }
  }
  for (int i = 1; i < n; i += k + 1) {
    for (int j = i; j < min(n, i + k); j++) need[j] = true;
  }
  vector<int> v;
  while (true) {
    cur = 0;
    for (int l = 1; l <= n; l++)
      if (good[l]) cur++;
    if (cur >= best) break;
    v.clear();
    for (int i = 1; i <= n; i++) {
      if (need[i] && !good[i]) v.push_back(i);
    }
    ask(v);
  }
  puts("0");
  fflush(stdout);
  return 0;
}
