#include <bits/stdc++.h>
using namespace std;
const long long T = 1e4;
long long p[10][T + 5], w[10], cnt[10], tp;
long long search(long long d, long long l) {
  if (d > 5) return l;
  cnt[d] = 0;
  long long now = min(l, T), r = search(d + 1, l);
  if (d == 5) {
    for (int i = 0; i < now; i++) p[d][++cnt[d]] = l + i;
    r = l + now - 1;
  } else
    for (long long i = 1; i <= now; i++) {
      ++r;
      p[d][++cnt[d]] = r;
      if (r >= T)
        r += w[5 - d];
      else
        r = search(d + 1, r + 1);
    }
  return r;
}
int main(void) {
  w[1] = T;
  for (int i = 2; i <= 4; i++) w[i] = (w[i - 1] + 1ll) * (T + 1) - 1ll;
  for (long long d = 1, l = 1; d <= 5; d++) {
    search(d, l);
    printf("%d ", cnt[d]);
    for (int i = 1; i <= cnt[d]; i++)
      printf("%lld%c", p[d][i], i < cnt[d] ? ' ' : '\n');
    fflush(stdout);
    scanf("%lld", &tp);
    if (tp < 0)
      break;
    else
      l = max(p[d][tp] + 1, l);
  }
  return 0;
}
