#include <bits/stdc++.h>
using namespace std;
int n;
bool a[1010], flag[1010];
vector<int> vec;
inline int ask(vector<int> &v) {
  printf("%d ", v.size());
  for (auto x : v) printf("%d ", x);
  printf("\n");
  fflush(stdout);
  int u;
  scanf("%d", &u);
  return u;
}
int main() {
  scanf("%d", &n);
  if (n <= 3) return printf("0") & 0;
  int mx = 0, k = 0, tmp;
  for (int i = (1), end_i = (n); i <= end_i; i++) {
    tmp = n - (n + i - 1) / i - i + 1;
    if (mx < tmp) mx = tmp, k = i;
  }
  for (int i = 1; i <= n; i += k) flag[i] = 1;
  for (;;) {
    int sum = 0, tim = k;
    for (int i = (1), end_i = (n); i <= end_i; i++)
      if (a[i]) sum++;
    if (sum >= mx) {
      printf("0\n");
      return 0;
    }
    vec.clear();
    for (int i = (1), end_i = (n); i <= end_i; i++)
      if (!a[i] && !flag[i]) {
        tim--;
        vec.push_back(i);
        a[i] = 1;
        if (!tim) break;
      }
    int u = ask(vec);
    for (int i = (1), end_i = (k); i <= end_i; i++) {
      a[u] = 0;
      u++;
      if (u > n) u = 1;
    }
  }
}
