#include <bits/stdc++.h>
using namespace std;
const int Imx = 2147483647;
const long long Lbig = 2e18;
const int mod = 1e9 + 7;
const long long B = 10000;
long long tab[6];
long long F(int n, long long m) {
  if (n == 1) return m + min(m, B) - 1;
  if (m < B) {
    long long cur = m;
    for (int i = 1; i <= m; i++) {
      cur = F(n - 1, cur) + 1;
      cur++;
    }
    return F(n - 1, cur);
  } else {
    return tab[n] + m;
  }
}
int query(vector<long long> &v) {
  printf("%d", int(v.size()));
  for (int i = 0; i < v.size(); i++) printf(" %I64d", v[i]);
  puts("");
  fflush(stdout);
  int ret;
  scanf("%d", &ret);
  if (ret < 0) exit(0);
  return ret;
}
void guess(int n, long long m) {
  vector<long long> v;
  if (n == 1) {
    for (int i = 0; i < min(B, m); i++) v.push_back(m + i);
  } else {
    long long cur = m;
    for (int i = 1; i <= min(B, m); i++) {
      cur = F(n - 1, cur) + 1;
      v.push_back(cur);
      cur++;
    }
  }
  int ret = query(v);
  if (ret == 0)
    guess(n - 1, m);
  else
    guess(n - 1, v[ret - 1] + 1);
}
int main() {
  tab[1] = B - 1;
  for (int i = 2; i <= 5; i++) tab[i] = tab[i - 1] * (B + 1) + 2 * B;
  guess(5, 1);
  return 0;
}
