#include <bits/stdc++.h>
using namespace std;
const int n = 10000;
long long qm[6][n + 2];
void ask(int i, long long b) {
  int j = min(b, (long long)n);
  vector<long long> v;
  long long r = qm[i - 1][j];
  for (int s = 1; s <= j; ++s) {
    v.push_back(r + b);
    ++r;
    r += qm[i - 1][min(r + j, (long long)n)];
    if (r > (long long)2e18) break;
  }
  printf("%d\n", int(v.size()));
  for (auto t : v) printf("%lld ", t);
  cout << endl;
  int t;
  cin >> t;
  if (t == -1) exit(0);
  if (t == 0) ask(i - 1, b);
  r = qm[i - 1][j];
  for (int s = 1; s <= j; ++s) {
    ++r;
    --t;
    if (!t) ask(i - 1, r + b);
    r += qm[i - 1][min(r + j, (long long)n)];
  }
}
int main() {
  for (int i = 1; i <= 4; ++i) {
    for (int j = 1; j <= n; ++j) {
      long long r = qm[i - 1][j];
      for (int s = 1; s <= j; ++s) {
        ++r, r += qm[i - 1][min(r + j, (long long)n)];
        if (r > (long long)2e18) break;
      }
      qm[i][j] = r;
    }
  }
  ask(5, 1);
}
