#include <bits/stdc++.h>
using namespace std;
int main() {
  int val;
  do {
    cout << "next 0 1\nnext 0\n" << flush;
    scanf("%d %*[^\n]", &val);
    scanf("%d %*[^\n]", &val);
  } while (val == 3);
  do {
    cout << "next 0 1 2 3 4 5 6 7 8 9\n" << flush;
    scanf("%d %*[^\n]", &val);
  } while (val == 2);
  cout << "done\n" << flush;
  return 0;
}
