#include <bits/stdc++.h>
using namespace std;
const int64_t INF = 4e18, MOD = 1e9 + 7;
const double eps = 1e-9;
int64_t n;
deque<int64_t> pos;
vector<bool> b;
int64_t cnt = 0;
void do_move(int64_t k) {
  k = min(k, (int64_t)pos.size());
  cout << k << " ";
  for (int64_t i = 0; i < k; i++) {
    int64_t first = pos.front();
    b[first] = 1;
    cout << first + 1 << " ";
    pos.pop_front();
  }
  cout << endl;
  cnt += k;
  int64_t first;
  cin >> first;
  first--;
  for (int64_t i = 0; i < k; i++) {
    int64_t ind = (i + first) % n;
    if (!b[ind]) continue;
    cnt--;
    b[ind] = 0;
    pos.push_front(ind);
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  if (n <= 3) return cout << 0 << endl, 0;
  b.resize(n);
  int64_t best = -1, k = 0;
  for (int64_t i = 1; i < n; i++) {
    int64_t v = n - (n + i - 1) / i - (i - 1);
    if (v > best) best = v, k = i;
  }
  vector<vector<int64_t> > tmp(k);
  for (int64_t i = 0; i < n; i++) {
    tmp[i % (k)].push_back(i);
  }
  for (int64_t i = 1; i < k; i++)
    for (auto ind : tmp[i]) pos.push_back(ind);
  int64_t last = cnt;
  while (cnt <= best) {
    do_move(k);
    if (last == cnt) break;
    last = cnt;
  }
  cout << 0 << endl;
  return 0;
}
