#include <bits/stdc++.h>
using namespace std;
int n, ans[1010], cur[1010], m, i, j, r, x, num;
int main() {
  scanf("%d", &n);
  r = m = 0;
  for (i = 1; i <= n; i++) {
    if (n * i / (i + 1) - i > r) {
      r = n * i / (i + 1) - i;
      m = i;
    }
  }
  if (r == 0) {
    printf("0\n");
    fflush(stdout);
    return 0;
  }
  for (i = 1; i < n; i++) {
    if (i % (m + 1) != 0) ans[i] = 1;
  }
  while (1 == 1) {
    num = 0;
    for (i = 1; i < n; i++) num += cur[i];
    if (num == r) {
      printf("0\n");
      fflush(stdout);
      return 0;
    }
    num = 0;
    for (i = 1; i <= n; i++)
      if (ans[i] != cur[i]) num++;
    printf("%d", num);
    for (i = 1; i <= n; i++) {
      if (ans[i] != cur[i]) printf(" %d", i);
      cur[i] = ans[i];
    }
    printf("\n");
    fflush(stdout);
    scanf("%d", &x);
    for (i = 0; i < num; i++) {
      cur[x] = 0;
      x++;
      if (x > n) x -= n;
    }
  }
  return 0;
}
