import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Scanner;

public class RandomAgent {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Random random = new Random();

        scanner.nextLine();//player count & player Id

        while (true) {
            System.err.println("Last played cards= " + scanner.nextLine());//last played cards
            List<Integer>[] lines = new ArrayList[4];
            for (int i=0;i<4;++i) {
                scanner.nextLine();//line cards count
                String input = scanner.nextLine();
                System.err.println(input);
                String[] data = input.split(" ");
                lines[i] = new ArrayList<>();
                for(String value : data) {
                    lines[i].add(Integer.parseInt(value));
                }
            }
            //scores
            String input = scanner.nextLine();
            System.err.println(input);

            List<Integer> cardsInHand = new ArrayList<>();
            int cardscount = Integer.parseInt(scanner.nextLine());//player cards count
            System.err.println(Integer.toString(cardscount) + " cards in hand");
            input = scanner.nextLine();
            System.err.println("*" + input + "*");
            for(String card : input.split(" ")) {
                cardsInHand.add(Integer.parseInt(card));
            }

            String action = scanner.nextLine();//game phase
            System.err.println(action);

            System.out.println("RANDOM");
        }
    }
}
