#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();
  int n;
  cin >> n;
  vector<int> ans(10);
  for (int i = 0; i < n; i++) {
    string x;
    cin >> x;
    for (int j = 0; j < x.size(); j++) {
      ans[x[j] - '0'] = i;
    }
  }
  return ans;
}
void solve() {
  vector<int> pos(10, 0);
  pos = zapr(vector<int>{0, 1});
  pos = zapr(vector<int>{1});
  while (pos[0] != pos[1]) {
    pos = zapr(vector<int>{0, 1});
    pos = zapr(vector<int>{1});
  }
  while (pos[0] != pos[2]) {
    pos = 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;
}
