import java.io.IOException;
import java.io.PrintWriter;
import java.util.*;

public class TestsGen {
	static final Random rand = new Random(32476353L);
	static final int maxSalary = 999999999;
	static final String[] PLAYERS = { "Denisov", "Hulk", "Kerzhakov",
			"Malafeev", "Anyukov", "Shirokov", "Alves", "Lazovic", "Danny",
			"Hubocan", "Fayzulin", "Criscito", "Bukharov", "Lukovic", "Semak",
			"Witsel", "Zhevnov", "Cheminava", "Yanbaev", "Dordevic", "Lumb",
			"Kanunnikov", "Insuralde", "Bryzgalov", "Mahmudov", "Pareja",
			"Carioca", "Kombarov", "McGeady", "Ari", "Dzyuba", "Welliton",
			"Yakovlev", "Parshivlyuk", "Suchy", "Jurado", "deZeeuw",
			"Kallstrom", "Kombarov", "Bilyaletdinov", "Emenike", "Pesyakov",
			"Dikan", "Rebrov", "Makeev", "Romulo", "Maloyan", "Gatagov",
			"Ananidze", "Sovetkin", "Anisin", "Babenko", "Barantsev", "Boikov",
			"Cherepenin", "Derlyuk", "Erpev", "Gorkhov", "Gorovikov", "Granak",
			"Gynge", "Jalasvaara", "Karpushkin", "Kasianchuk", "Knyazev",
			"Kokarev", "Konkov", "Kvapil", "Mosalev", "Novak", "Ovechkin",
			"Pestunov", "Shadilov", "Shafigulin", "Soin", "Soloviev",
			"Tolpeko", "Tsvetkov", "Vishnevsky", "Volkov", "Volkov",
			"Yeremenko" };
	static final String[] COUNTRIES = { "Russia", "Brazil", "Russia", "Russia",
			"Russia", "Russia", "Portugal", "Serbia", "Portugal", "Slovakia",
			"Russia", "Italy", "Russia", "Serbia", "Russia", "Belgium",
			"Russia", "Russia", "Russia", "Russia", "Montenegro", "Russia",
			"Argentina", "Russia", "Russia", "Argentina", "Brazil", "Russia",
			"Ireland", "Brazil", "Russia", "Brazil", "Russia", "Russia",
			"CzhechRepubplic", "Spain", "Netherlands", "Sweden", "Russia",
			"Russia", "Nigeria", "Russia", "Ukraine", "Russia", "Russia",
			"Brazil", "Russia", "Russia", "Georgia", "Russia", "Russia",
			"Russia", "Russia", "Russia", "Russia", "Russia", "Russia",
			"Russia", "Russia", "Slovakia", "Sweden", "Finland", "Russia",
			"Ukraine", "Russia", "Russia", "Russia", "CzhechRepublic",
			"Russia", "CzhechRepublic", "Russia", "Russia", "Russia", "Russia",
			"Russia", "Russia", "Russia", "Russia", "Russia", "Russia",
			"Russia", "Russia" };

	class Player {
		int salary;
	}

	static class Test {
		private static final String RUSSIA = "Russia";
		int n;
		int[] salaries;
		String[] players;
		String[] countries;

		public Test(int n, int max, int denisovWish, int maxRusSalary) {
			this.n = n;

			players = new String[n];
			countries = new String[n];
			salaries = new int[n];
			ArrayList<Integer> idxes = new ArrayList<Integer>(n);
			int maxRus = 0;
			for (int i = 0; i < n - 1; i++) {
				idxes.add(rand.nextInt(max - 1) + 1);
			}
			idxes.add(0);
			Collections.shuffle(idxes, rand);
			int denisovIdx = 0;
			for (int i = 0; i < n; i++) {
				players[i] = PLAYERS[idxes.get(i)];
				countries[i] = COUNTRIES[idxes.get(i)];
				if (idxes.get(i) == 0) {
					denisovIdx = i;
					continue;
				}                                            
				if (COUNTRIES[idxes.get(i)].equals(RUSSIA)) {					
					this.salaries[i] = rand.nextInt(maxRusSalary);
					maxRus = Math.max(maxRus, salaries[i]);
				}
				else {
					this.salaries[i] = rand.nextInt(maxSalary);
				}
			}
			salaries[denisovIdx] = Math.min(maxRus + 1 + rand.nextInt(denisovWish - 1),
					1000000000);
		}

		void printMe(PrintWriter out) {
			out.println(n);
			for (int i = 0; i < n; i++) {
				out.println(salaries[i] + " " + players[i] + " " + countries[i]);
			}
		}
	}

	static int testNumber = 0;

	static void printTest(Test test) {
		System.err.printf("[%02d]\n", ++testNumber);
		try {
			PrintWriter out = new PrintWriter("../tests/" + testNumber / 10
					+ "" + testNumber % 10);
			test.printMe(out);
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	static void problemTest() {
		System.err.printf("[%02d]\n", ++testNumber);
		try {
			PrintWriter out = new PrintWriter("../tests/" + testNumber / 10
					+ "" + testNumber % 10);
			out.println(5);
			out.println("5000000 Banner Brazil");
			out.println("1000000 Malafeev Russia");
			out.println("3000000 Denisov Russia");
			out.println("2000000 Kerzhakov Russia");
			out.println("4000000 Criscito Italy");
			out.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		problemTest();
		printTest(new Test(1, 1, 1000000000, 1000000000));
		printTest(new Test(5, 25, 1000000000, 100000000));
		printTest(new Test(5, 25, 1000000000, 1000000000));
		for (int i = 0; i < 7; i++) {
			printTest(new Test(50, PLAYERS.length, 10, 100000));
		}
		for (int i = 0; i < 7; i++) {
			printTest(new Test(10, PLAYERS.length, 1000000000, 1000000000));
		}
		for (int i = 0; i < 5; i++) {
			printTest(new Test(20, PLAYERS.length, 1000000000, 900000000));
		}
		for (int i = 0; i < 8; i++) {
			printTest(new Test(PLAYERS.length, PLAYERS.length, 1000000000, 1000000000));
		}
	}

}
