#include <bits/stdc++.h>
using namespace std;
vector<int> zapr(vector<int> inp) {
  cout << "next ";
  for (int i = 0; i < inp.size(); i++) {
    cout << inp[i] << " ";
  }
  cout << '\n';
  cout.flush();
  vector<int> ans(10);
  int gr;
  cin >> gr;
  for (int q = 1; q <= gr; q++) {
    string x;
    cin >> x;
    for (int i = 0; i < x.size(); i++) {
      ans[x[i] - '0'] = q;
    }
  }
  return ans;
}
void solve() {
  vector<int> gr(10, 1);
  gr = zapr(vector<int>{0, 1});
  gr = zapr(vector<int>{1});
  while (gr[0] != gr[1]) {
    gr = zapr(vector<int>{0, 1});
    gr = zapr(vector<int>{1});
  }
  while (gr[2] != gr[1]) {
    gr = zapr(vector<int>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9});
  }
  cout << "done";
  cout.flush();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
