#include <bits/stdc++.h>
using namespace std;
int query(vector<int> v) {
  cout << "next ";
  for (int x : v) cout << x << ' ';
  cout << '\n';
  cout.flush();
  int k;
  cin >> k;
  string s;
  for (int i = 0; i < k; ++i) cin >> s;
  return k;
}
int main() {
  vector<int> a, b, c;
  a.push_back(0);
  b.push_back(0);
  b.push_back(1);
  for (int i = 0; i < 10; ++i) c.push_back(i);
  query(b);
  while (query(a) > 2) query(b);
  while (query(c) > 1)
    ;
  cout << "done";
}
