// Arup Guha
// 2/24/2024
// Solution to SER D1/D2 Problem J: Sequence Guessing

import java.util.*;

public class j {

	public static void main(String[] args) {
	
		Scanner stdin = new Scanner(System.in);
		
		// 0, 3, 6, 9, ..., 99999, 100000, plus one of (1,2), (4,5), etc.
		System.out.println(66668);
		System.out.flush();
		
		// These are definitely true.
		boolean[] in = new boolean[100001];
		boolean[] known = new boolean[100001];
		for (int i=0; i<100000; i+=3) {
			in[i] = true;
			known[i] = true;
		}
		in[100000] = true;
		known[100000] = true;
		
		// Read the query.
		int query = stdin.nextInt();
		int misses = 0;
		
		// Conditions to exit.
		while (query != -1 && misses < 33333) {
			
			// The adversary got a number.
			if (in[query]) {
				
				// Multiples of 3 are always in, at this rank.
				if (query%3 == 0) 
					System.out.println(1+2*(query/3));
				
				// Non-multiples of three will always be this rank.
				else 
					System.out.println(2*(query/3+1));
				System.out.flush();
			}
			
			// They miss and I mark both a hit and a miss.
			else {
				
				// Mark a miss.
				misses++;
				System.out.println(-1);
				System.out.flush();
				
				// Now, this is fixed.
				in[query] = false;
				known[query] = true;
				
				// So is this.
				if (query%3 == 1) {
					in[query+1] = true;
					known[query+1] = true;
				}
				
				// Or this.
				else {
					in[query-1] = true;
					known[query-1] = true;
				}
			}
			
			// Get next.
			query = stdin.nextInt();
		}
		
		// If they said -1, let's tell them the sequence.
		if (query == -1) {
			
			// We know this.
			System.out.println(0);
			
			// 2 out of every 3 are in.
			for (int i=1; i<99999; i+=3) {
				
				// I can choose...so I choose i.
				if (!known[i] && !known[i+1])
					System.out.println(i);
				
				// It's i.
				else if (in[i])
					System.out.println(i);
				
				// It must be i+1.
				else
					System.out.println(i+1);
				
				// Multiple of 3 is always in.
				System.out.println(i+2);
			}
			
			// And this.
			System.out.println(100000);	
		}
	}
}