#include <bits/stdc++.h>
using namespace std;
void solve();
mt19937 rng(time(0));
long long qpow(long long x, long long p, long long MOD) {
  long long res = 1, v = x;
  while (p) {
    if (p & 1) {
      res *= v;
      res %= MOD;
    }
    v *= v;
    v %= MOD;
    p >>= 1;
  }
  return res;
}
long long inv(long long x, long long MOD) { return qpow(x, MOD - 2, MOD); }
void init() {}
long long read() {
  int ch = getchar();
  if (ch == EOF) {
    return INT_MIN;
  }
  while (!isdigit(ch) && ch != '-') {
    ch = getchar();
    if (ch == EOF) {
      return INT_MIN;
    }
  }
  long long res = 0, sign = 1;
  if (ch == '-') {
    ch = getchar();
    sign = -1;
  }
  while (isdigit(ch)) {
    res = res * 10 + ch - '0';
    ch = getchar();
  }
  return res * sign;
}
int main() {
  init();
  solve();
  return 0;
}
const int MAXN = 1005;
int a[MAXN] = {0};
void solve() {
  int n = read();
  if (n <= 3) {
    puts("0");
    fflush(stdout);
  } else {
    int mxc = 0, mxk = -1;
    for (int k = 1; k <= n; ++k) {
      int curc = n - ((n + k - 1) / k + k - 1);
      if (curc > mxc) {
        mxc = curc;
        mxk = k;
      }
    }
    for (;;) {
      vector<int> v;
      for (int i = 0; i < n; ++i) {
        if (((i + 1) % mxk) && i != n - 1 && a[i] == 0) {
          a[i] = 1;
          v.push_back(i + 1);
          if ((int)v.size() == mxk) {
            break;
          }
        }
      }
      if ((int)v.size() < mxk) {
        puts("0");
        fflush(stdout);
        break;
      } else {
        printf("%d ", mxk);
        for (int i : v) {
          printf("%d ", i);
        }
        printf("\n");
        fflush(stdout);
        int x = read() - 1;
        for (int i = 0; i < mxk; ++i) {
          a[(x + i) % n] = 0;
        }
      }
    }
  }
}
