#include <bits/stdc++.h>
using namespace std;
int mas[1000] = {0};
int v[100];
int main() {
  int n, s, k, h, x;
  cin >> n;
  s = floor(sqrt(n));
  k = ceil(1 + sqrt(n - 1));
  while (1) {
    h = 0;
    for (int i = 0; i < n; ++i)
      if (mas[i] == 0 && i % s != 0) {
        h++;
        v[h - 1] = i + 1;
        mas[i] = 1;
        if (h == s) break;
      }
    if (h < s) {
      cout << endl << 0 << endl;
      cout.flush();
      return 0;
    } else {
      cout << s;
      for (int i = 0; i < s; ++i) cout << ' ' << v[i];
      cout << endl;
      cout.flush();
      cin >> x;
      if (x == -1) return 0;
      x--;
      for (int i = x; i <= x + s - 1; ++i) mas[i % n] = 0;
    }
  }
}
