#include <bits/stdc++.h>
using namespace std;
const long long N = 10000;
long long dp[N][5][2], pos[N], pw[5] = {1};
long long solve(long long l, long long tim, bool ask = false) {
  if (tim == 0) {
    return l + 1;
  }
  if (l >= N) {
    if (ask) {
      cout << N;
      for (long long i = 1; i <= N; i++) {
        cout << " " << l + pw[tim - 1] * i;
      }
      cout << endl;
      long long ret;
      cin >> ret;
      if (ret == -1) {
        exit(0);
      }
      solve(l + ret * pw[tim - 1], tim - 1, true);
    }
    return l + pw[tim];
  }
  if (dp[l][tim - 1][ask] > 0) {
    return dp[l][tim - 1][ask];
  }
  if (ask) {
    cout << l + 1;
    pos[0] = l;
  }
  long long cur = solve(l, tim - 1);
  for (long long i = 0; i <= l; i++) {
    if (ask) {
      pos[i + 1] = cur;
      cout << " " << cur;
    }
    cur = solve(cur, tim - 1);
  }
  if (ask) {
    cout << endl;
    long long ret;
    cin >> ret;
    if (ret == -1) {
      exit(0);
    }
    solve(pos[ret], tim - 1, true);
  }
  return dp[l][tim - 1][ask] = cur;
}
signed main() {
  for (long long i = 1; i < 5; i++) {
    pw[i] = pw[i - 1] * 10001;
  }
  solve(0, 5, true);
  return 0;
}
