#include <bits/stdc++.h>
using namespace std;
void ask(long long x) {}
long long tr;
vector<long long> que;
long long ask() {
  printf("%d ", que.size());
  for (int i = 0; i < que.size(); i++) printf(" %lld", que[i]);
  printf("\n");
  fflush(stdout);
  int x = 0;
  scanf("%d", &x);
  if (x == -1) exit(0);
  if (x == -2) assert(0);
  return x;
}
long long calc(int q, long long x) {
  if (q == 1) {
    return min(x * 2 - 1, x + 9999);
  }
  if (x >= 10000) {
    if (q == 2) return x + 10001 * 10001 - 2;
  }
  long long cs, now;
  cs = x, now = cs;
  for (int i = 1; i <= min(10000ll, cs) + 1; i++) {
    long long tmp = calc(q - 1, now);
    now = tmp + 2;
  }
  return now - 2;
}
void dfs(int q, long long x) {
  if (q == 1) {
    que.clear();
    for (long long i = x; i <= min(x * 2ll - 1, x + 9999ll); i++)
      que.push_back(i);
    ask();
    return;
  }
  if (x >= 10000) {
    if (q == 2) {
      que.clear();
      for (int i = 1; i <= 10000; i++) que.push_back(x + i * 10001ll - 1);
      int tmp = ask();
      dfs(q - 1, x + tmp * 10001);
      return;
    }
  }
  long long cs, now;
  cs = x, now = cs;
  que.clear();
  for (int i = 1; i <= min(10000ll, cs) + 1; i++) {
    long long tmp = calc(q - 1, now);
    if (i <= min(10000ll, cs)) que.push_back(tmp + 1);
    now = tmp + 2;
  }
  long long tmp = ask();
  if (tmp == 0)
    dfs(q - 1, x);
  else
    dfs(q - 1, que[tmp - 1] + 1);
}
int main() { dfs(5, 1); }
