Problem: This is an interactive problem.

Misha likes to play cooperative games with incomplete information. Today he suggested ten his friends to play a cooperative game "Lake".

Misha has already come up with a field for the upcoming game. The field for this game is a directed graph consisting of two parts. The first part is a road along the coast of the lake which is a cycle of c vertices. The second part is a path from home to the lake which is a chain of t vertices, and there is an edge from the last vertex of this chain to the vertex of the road along the coast which has the most beautiful view of the lake, also known as the finish vertex. Misha decided to keep the field secret, so nobody knows neither t nor c.

<image>

Note that each vertex of the field has exactly one outgoing edge and all the vertices except the home vertex and the finish vertex have exactly one ingoing edge. The home vertex has no incoming edges, the finish vertex has two incoming edges.

At the beginning of the game pieces of all the ten players, indexed with consecutive integers from 0 to 9, are at the home vertex. After that on each turn some of the players can ask Misha to simultaneously move their pieces along the corresponding edges. Misha will not answer more than q such queries. After each move Misha will tell players whose pieces are at the same vertices and whose pieces are at different vertices.

The goal of the game is to move all the pieces to the finish vertex. Misha's friends have no idea how to win in such a game without knowledge of c, t and q, but luckily they are your friends. Help them: coordinate their actions to win the game. 

Misha has drawn such a field that 1 ≤ t, c, (t+c) ≤ 1000 and q = 3 ⋅ (t+c).

Input

There is no input — go to the interaction part straight away.

Output

After all friends gather at the finish vertex, print "done" and terminate your program.

Interaction

To give a command to move the friends, print "next" and then space-separated indices of the friends you want to move. For example, to give the command to move the friends with indices 0, 2, 5 and 9 print "next 0 2 5 9". At each turn, you must move at least one of your friends.

As an answer, first read an integer k, and then 10 digits divided into k space-separated groups. The friends that correspond to the indices in the same group are in the same vertex. The friends that correspond to indices in different groups are in different vertices. The indices in each group follow in ascending order.

For example, the answer "2 05 12346789" means that the friends with indices 0 and 5 are in one vertex, and all other friends are in the same but different vertex. The answer "4 01 567 234 89" means that Misha's friends are in four different vertices: the friends with indices 0 and 1 are in the first, the friends with indices 5, 6 and 7 are in the second, the friends with indices 2, 3 and 4 are in the third, and the friends with indices 8 and 9 are in the fourth.

After printing a query do not forget to output end of line and flush the output. Otherwise you will get Idleness limit exceeded. To do this, use:

  * fflush(stdout) or cout.flush() in C++; 
  * System.out.flush() in Java; 
  * flush(output) in Pascal; 
  * stdout.flush() in Python; 
  * see documentation for other languages. 



Answer "stop" instead of a valid one means that you made an invalid query. Exit immediately after receiving "stop" and you will see Wrong answer verdict. Otherwise you can get an arbitrary verdict because your solution will continue to read from a closed stream.

Hacks

In order to hack, print two integers t and c in a single line (1 ≤ t, c, (t+c) ≤ 1000).

Example

Input


2 05 12346789

3 246789 135 0

3 246789 0 135

3 246789 0 135

2 135 0246789

1 0123456789


Output


next 0 5

next 0 1 3

next 2 3 0 1 4 5 6 7 8 9

next 9 8 7 6 5 4 3 2 1 0

next 0 1 3 5

next 1 3 5

done

Note

In the sample input and output values are aligned only for simplicity of interpreting them chronologically. In real interaction no "extra" line breaks should appear.

In the example, the friends move as follows:

<image>

Solution (in JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
 
import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        public InputReader(InputStream stream) {
            this.stream = stream;
        }
        
        public int read() {
            if (numChars==-1) 
                throw new InputMismatchException();
            
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }
                
                if(numChars <= 0)               
                    return -1;
            }
            return buf[curChar++];
        }
     
        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();
            
            while(isSpaceChar(c)) 
                c = read();
            
            int sgn = 1;
            
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            
            int res = 0;
            do {
                if(c<'0'||c>'9') 
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c)); 
            
            return res * sgn;
        }
        
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            while (!isSpaceChar(c));
                return res * sgn;
        }
        
        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        
        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } 
            while (!isSpaceChar(c));
            
            return res.toString();
        }
     
        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
     
        public String next() {
            return readString();
        }
        
        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<27).start();
    }
    boolean contains(char[] s, int i) {
        for(int j = 0; j < s.length; ++j) {
            if(s[j] - '0' == i) 
                return true;
        }
        return false;
    }
    boolean isTogetherStored(int[] a) {
        int k = cache.length;

        boolean mainFlag = false;

        for(int i = 0; i < k; ++i) {
            int flag = 0;
            char[] s = cache[i];
            for(int j = 0; j < a.length; ++j) {
                if(!contains(s, a[j]))
                    flag = 1;
            }
            if(flag == 0) {
                mainFlag = true;
            }
        }

        return mainFlag;
    }
    boolean isTogether(int[] a) {
        int k = sc.nextInt();
        cache = new char[k][];

        boolean mainFlag = false;

        for(int i = 0; i < k; ++i) {
            int flag = 0;
            char[] s = sc.next().toCharArray();
            cache[i] = s;
            for(int j = 0; j < a.length; ++j) {
                if(!contains(s, a[j]))
                    flag = 1;
            }
            if(flag == 0) {
                mainFlag = true;
            }
        }

        return mainFlag;
    }
    char[][] cache;
    void move(int[] a) {
        System.out.print("next ");
        for(int i : a)
            System.out.print(i + " ");
        System.out.println();
        System.out.flush();
    }
    InputReader sc;
    public void run() {
        sc = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);

        int step = 1;
        while(true) {
            if(step % 2 == 1) {
                int[] arr = new int[]{0};
                move(arr);
            }
            else {
                int[] arr = new int[]{0, 1};
                move(arr);
            }

            int[] arr = new int[]{0, 1};
            if(isTogether(arr))
                break;

            step++;
        }

        while(true) {
            int[] arr = new int[]{0, 2};
            move(arr);

            arr = new int[]{0, 1};
            if(isTogether(arr))
                break;
        }

        while(true) {
            int[] arr = new int[]{2, 3, 4, 5, 6, 7, 8, 9};
            move(arr);

            if(isTogether(arr)) {
                break;
            }
        }

        int[] temp = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        while(!isTogetherStored(temp)) {
            int[] arr = new int[]{0, 1};
            move(arr);

            isTogether(arr);
        }

        System.out.println("done");
        System.out.flush();

        w.close();
    }
}