#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> cir(n, 0);
  int k = 1;
  for (int i = 1; i <= n; i++)
    if (n - i - ((n / i) + (n % i > 0)) + 1 >
        n - k - ((n / k) + (n % k > 0)) + 1)
      k = i;
  while (true) {
    int diff = 0;
    vector<int> ask;
    for (int i = 0; i < n && ask.size() < k; i++) {
      if (i % k == 0 || cir[i]) continue;
      ask.push_back(i);
      cir[i] = 1;
      diff++;
    }
    if (ask.size() == 0) {
      cout << "0\n";
      return 0;
    }
    cout << ask.size() << "\n";
    for (auto i : ask) cout << i + 1 << " ";
    cout << "\n";
    int val;
    cin >> val;
    if (val == -1) return 0;
    for (int i = val - 1, c = 0; c < k; c++, i = (i + 1) % n) {
      diff -= cir[i] == 1;
      cir[i] = 0;
    }
    if (diff == 0) {
      cout << "0\n";
      return 0;
    }
  }
}
