#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 10, M = 10000;
const double Pi = acos(-1);
inline long long read() {
  long long x = 0, f = 1, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - 48, ch = getchar();
  return x * f;
}
long long n;
long long p[N], d[N];
long long f(long long x, long long c) {
  if (x >= M) return x + p[c] - 1;
  if (c == 1) return x + min(x, M);
  long long y = min(x, M) + 1;
  --x;
  for (register long long i = 1; i <= y; ++i) x = f(x + 1, c - 1);
  return x;
}
void solve(long long x, long long c) {
  long long y = min(x, M) + 1;
  d[0] = --x;
  if (c == 1)
    for (register long long i = 1; i <= y; ++i) d[i] = ++x;
  else
    for (register long long i = 1; i <= y; ++i) x = f(x + 1, c - 1), d[i] = x;
  printf("%lld ", --y);
  for (register long long i = 1; i <= y; ++i) printf("%lld ", d[i]);
  puts("");
  fflush(stdout);
  long long k = read();
  if (k < 0) exit(0);
  return solve(d[k] + 1, c - 1);
}
signed main() {
  p[0] = 1;
  for (register long long i = 1; i <= 5; ++i) p[i] = p[i - 1] * 10001;
  solve(1, 5);
  return 0;
}
