#include <bits/stdc++.h>
using namespace std;
const long long K = 10000;
long long f[K + 10][10];
void Init(void) {
  for (int i = 1; i <= K; i++) f[i][1] = i;
  for (int j = 2; j <= 5; j++)
    for (int i = 1; i <= K; i++) {
      long long now = i;
      for (int k = 1; k <= i + 1; k++) {
        f[i][j] += f[now][j - 1];
        now += f[now][j - 1] + 1;
        if (now > K) {
          f[i][j] += f[K][j - 1] * (i - k + 1);
          break;
        }
      }
      f[i][j] += i;
    }
  cerr << f[1][4] + 1 + f[K][4] << endl;
  cerr << f[1][5] << endl;
}
void Query(int o, long long l) {
  printf("%lld ", min(K, l));
  long long now = l;
  for (int i = 1; i <= min(K, l); i++) {
    now += f[min(K, now)][o - 1];
    printf("%lld ", now);
    now++;
  }
  puts("");
  fflush(stdout);
  int op;
  scanf("%d", &op);
  if (op == -1) return;
  now = l;
  ++op;
  for (int i = 1; i <= min(K, l) + 1; i++) {
    if (op == i) {
      Query(o - 1, now);
      break;
    }
    now += f[min(now, K)][o - 1] + 1;
  }
}
int main(void) {
  Init();
  Query(5, 1);
}
