#include <bits/stdc++.h>
using namespace std;
int n, sum, vis[10005], xiba[10005];
int main() {
  scanf("%d", &n);
  if (n <= 3) {
    cout << 0 << endl;
    exit(0);
  }
  int val = 0, p = 0;
  for (int i = (int)(2); i <= (int)(n); i++) {
    int t = n - n / i - (n % i != 0) - (i - 1);
    if (t > val) val = t, p = i;
  }
  for (int i = (int)(1); i <= (int)(n); i++) xiba[i] = (i % p && i != n);
  int lim = val;
  for (; sum < lim;) {
    cout << val + p - 1 - sum;
    for (int i = (int)(1); i <= (int)(n - 1); i++)
      if (xiba[i] && !vis[i]) vis[i] = 1, cout << ' ' << i;
    cout << endl;
    int len = lim + p - 1 - sum;
    sum += len;
    int p;
    cin >> p;
    for (int j = (int)(1); j <= (int)(len); j++) {
      sum -= vis[p];
      vis[p] = 0;
      p = p % n + 1;
    }
  }
  cout << 0 << endl;
}
