#include <bits/stdc++.h>
using namespace std;
const int N = 1010;
int vis[N];
vector<int> a[N], tmp;
int main() {
  int n;
  scanf("%d", &n);
  int x = 1;
  for (int i = 2; i <= n; i++) {
    if (n - (n + i - 1) / i - i + 1 > n - (n + x - 1) / x - x + 1) x = i;
  }
  int ans = n - (n + x - 1) / x - x + 1;
  int cur = 0;
  for (int i = 1; i <= n; i++) {
    if (i % x == 1) cur++;
    a[cur].push_back(i);
  }
  int cnt = 0;
  while (cnt < ans) {
    for (int i = 1; i <= cur; i++) {
      int sz = a[i].size();
      for (int j = 0; j < sz - 1; j++) {
        if (!vis[a[i][j]]) {
          vis[a[i][j]] = 1;
          tmp.push_back(a[i][j]);
        }
        if (tmp.size() == x) break;
      }
      if (tmp.size() == x) break;
    }
    int k = tmp.size();
    cnt += k;
    printf("%d ", k);
    for (int j : tmp) printf("%d ", j);
    printf("\n");
    fflush(stdout);
    tmp.clear();
    int pos;
    scanf("%d", &pos);
    for (int i = 1; i <= k; i++) {
      if (vis[pos]) cnt--;
      vis[pos] = 0;
      pos = pos % n + 1;
    }
  }
  printf("0\n");
  fflush(stdout);
  return 0;
}
