#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false),
            cout << fixed << setprecision(9), 0);
vector<int> state;
void makemove(vector<int>& A) {
  if (A.empty()) {
    cout << 0 << endl;
    exit(0);
  } else {
    cout << A.size() << ' ';
    for (auto a : A) {
      state[a] = 1;
      cout << a + 1 << ' ';
    }
    cout << endl;
  }
  int input;
  cin >> input;
  if (input == 0 || input == -1) {
    exit(0);
  }
  for (int i = 0; i < A.size(); i++) {
    state[(input - 1 + i) % state.size()] = 0;
  }
}
int main() {
  int N;
  cin >> N;
  state.resize(N);
  int K = 0, R = 0;
  for (int i = 1; i <= N; i++) {
    int p = N / i;
    int r = N % i;
    int RR = (p - 1) * (i - r) + p * r - (r == 0 ? p - 1 : p);
    if (RR > R) {
      K = i;
      R = RR;
    }
  }
  vector<int> optimum;
  if (R == 0) {
    optimum.resize(N);
  } else {
    int p = N / K;
    int r = N % K;
    for (int i = 0; i < K - r; i++) {
      for (int j = 0; j < p; j++) {
        optimum.push_back(!!j);
      }
    }
    for (int i = 0; i < r; i++) {
      for (int j = 0; j < p + 1; j++) {
        optimum.push_back(!!j);
      }
    }
    assert(optimum.size() == N);
  }
  vector<int> move;
  for (;;) {
    move.clear();
    int cnt = 0;
    for (int i = 0; i < N; i++) {
      if (optimum[i] != state[i]) {
        move.push_back(i);
      }
      cnt += state[i];
    }
    if (cnt >= R) {
      move.clear();
    }
    makemove(move);
  }
  return 0;
}
