#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int sum;
  cin >> sum;
  if (sum == -1) exit(0);
  return sum;
}
void out(int w) {
  cout << w << '\n';
  cout.flush();
}
bool used[1010];
bool suan[1010];
int n;
int num() {
  int nas = 0;
  for (int i = 1; i <= n; i++)
    if (used[i]) nas++;
  return nas;
}
int huan(int w) {
  if (w <= n) return w;
  return w - n;
}
int huanqian(int w) {
  if (w >= 1) return w;
  return n - w;
}
int main() {
  n = read();
  int K = 0, mmax = 0;
  for (int i = 1; i < n; i++) {
    int tt = n - i - (n - 1) / i;
    if (mmax < tt) mmax = tt, K = i;
  }
  if (K) {
    for (int i = 1; i <= n; i++)
      if (i % K != 1) suan[i] = 1;
    while (1) {
      if (num() >= mmax) break;
      cout << K << " ";
      int dg = K;
      for (int i = 1; i <= n && dg; i++)
        if (!used[i] && suan[i]) cout << i << " ", used[i] = 1, dg--;
      cout << '\n';
      cout.flush();
      int g = read();
      for (int j = 1; j <= K; j++) used[huan(g + j - 1)] = 0;
    }
  }
  out(0);
  return 0;
}
