#include <bits/stdc++.h>
template <typename T>
bool chkmax(T &x, T y) {
  return x < y ? x = y, true : false;
}
template <typename T>
bool chkmin(T &x, T y) {
  return x > y ? x = y, true : false;
}
using namespace std;
long long ksm(long long a, long long b) {
  if (!b) return 1;
  long long ns = ksm(a, b >> 1);
  ns = ns * ns % 998244353;
  if (b & 1) ns = ns * a % 998244353;
  return ns;
}
int tp[100005];
int fl[100005];
int main() {
  int mn = 1e9, pl = 0;
  int n;
  cin >> n;
  for (int k = 1; k <= n; k++) {
    int ns = (n / k);
    if (n % k) ns++;
    ns += (k - 1);
    if (chkmin(mn, ns)) pl = k;
  }
  for (int i = 1; i <= n; i += pl)
    for (int j = i; j < (i + pl) && j <= n; j++) {
      if (j == i + pl - 1 || j == n)
        fl[j] = 0;
      else
        fl[j] = 1;
    }
  while (1) {
    int tot = 0;
    for (int i = 1; i <= n; i++) tot += tp[i];
    if (tot >= n - mn) {
      cout << 0 << endl;
      break;
    }
    cout << pl << ' ';
    int cnt = pl;
    for (int i = 1; i <= n; i++)
      if (!tp[i] && fl[i]) {
        cnt--;
        cout << i << ' ';
        tp[i] = 1;
        if (cnt == 0) break;
      }
    cout << endl;
    fflush(stdout);
    int res;
    cin >> res;
    for (int i = 1; i <= pl; i++) {
      tp[res] = 0;
      res++;
      if (res > n) res = 1;
    }
  }
  return 0;
}
