#include <bits/stdc++.h>
using namespace std;
inline long long readInt() {
  long long in;
  scanf("%lld", &in);
  return in;
}
inline long long ADD(long long a, long long b, long long mod) {
  return ((a + b) % mod + mod) % mod;
}
inline long long SUBS(long long a, long long b, long long mod) {
  return ((a - b) % mod + mod) % mod;
}
inline long long MUL(long long a, long long b, long long mod) {
  return ((a * b) % mod + mod) % mod;
}
long long bigMod(long long base, long long power, long long mod) {
  if (!power) return 1;
  if (!base) return 0;
  long long temp = bigMod(base, power / 2, mod);
  if (power % 2 == 0) {
    return (temp * temp) % mod;
  } else
    return (((temp * temp) % mod) * base) % mod;
}
inline long long modInverse(long long a, long long modp) {
  return bigMod(a, modp - 2, modp);
}
inline long long modInverseExtended(long long a, long long m) {
  long long m0 = m;
  long long y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long q = a / m;
    long long t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
void autoinput() {}
long long D(long long n) {
  n--;
  if (n == 0) return 0;
  long long mx = 0, val = 0;
  for (long long i = 1; i <= n; i++) {
    long long x = n - (n / i) - (i - 1);
    if (x > val) {
      val = x;
      mx = i;
    }
  }
  return mx;
}
long long R(long long n) {
  long long i = D(n);
  n--;
  if (i == 0) return 0;
  return (n - (n / i) - (i - 1));
}
void play(long long k, vector<long long> &arr, vector<long long> &cur,
          long long N) {
  long long l = 0;
  vector<long long> lamps;
  for (long long i = 1; i <= N; i++) {
    if (arr[i] != cur[i]) {
      lamps.push_back(i);
      l++;
      cur[i] = 1;
    }
  }
  if (l < k) {
    cout << "0" << endl;
    cout.flush();
    exit(0);
  }
  cout << l << endl;
  for (auto p : lamps) {
    cout << p << " ";
  }
  cout << endl;
  cout.flush();
  long long y;
  cin >> y;
  if (y == -1) exit(0);
  for (long long i = y; i < y + l; i++) {
    long long j = i;
    if (i > N) j = i - N;
    cur[j] = 0;
  }
}
int main() {
  long long N = readInt();
  if (R(N) == 0) {
    cout << "0" << endl;
    cout.flush();
    return 0;
  }
  vector<long long> arr(N + 1, 1), cur(N + 1, 0);
  arr[N] = 0;
  long long k = D(N);
  for (long long i = k; i < N; i += k) {
    arr[i] = 0;
  }
  while (1) play(k, arr, cur, N);
}
