import java.io.*;
import java.util.*;

public class TestsGen implements Runnable {
	public static void main(String[] args) {
		new TestsGen().run();
	}

	public int done = 0;
	ArrayList<String> data = new ArrayList<String>();

	private final int SMALL = 100;
	private final int LARGE = 1000;

	private final int LOW = (int) 1e3;
	private final int HIGH = (int) 1e9;

	public void print() throws IOException {
		done++;
		System.err.println(done);
		PrintWriter out;
		if (done < 10)
			out = new PrintWriter("0" + String.valueOf(done));
		else
			out = new PrintWriter(String.valueOf(done));

		for (int i = 0; i < data.size(); i++)
			out.println(data.get(i));
		out.println();
		out.close();
		data.clear();
	}

	public int nextInt(int low, int high) {
		if (low > high) {
			return high;
		}
		int base = high - low + 1;
		int val = rnd.nextInt();
		val %= base;
		while (val < 0)
			val += base;
		val += low;
		return val;
	}

	Random rnd;

	HashSet<String> used = new HashSet<String>();
	HashSet<Integer> usedCost = new HashSet<Integer>();

	public void genRand(int minNumber, int maxNumber, int minCost, int maxCost,
			int notStupid) throws IOException {
		// System.err.println((done+1));
		used.clear();
		usedCost.clear();

		String fname = getName();
		while (used.contains(fname)) {
			fname = getName();
		}
		data.add(fname);

		long cost = nextInt(minCost, maxCost);
		data.add(String.valueOf(cost));

		int a = nextInt(1, 100);
		int b = nextInt(a, 100);

		long low = a * cost;
		long high = b * cost;
		if (low / 100 == high / 100 && low % 100 != 0 && high % 100 != 0) {
			a--;
			if (a == 0) {
				a++;
				b--;
			}
			if (b == 0) {
				b = 90;
			}
		}
		while (cost * 10 <= maxCost && low / 100 == high / 100
				&& low % 100 != 0 && high % 100 != 0) {
			cost *= 10;
		}
		// System.err.println("Good");
		// System.err.println(a + " " + cost);
		// System.err.println(b + " " + cost);
		if (notStupid == 1) {
			if (a == 100) {
				a--;
			}
			while ((a * cost) % 100 == 0) {
				cost--;
			}
		}

		low = Math.max(0, (a * cost - 1) / 100);
		high = Math.min((b * cost) / 100, HIGH);
		minCost = (int) Math.min(low - 1, minCost);
		maxCost = (int) Math.max(high, maxCost);

		data.add(a + " " + b);

		int n = nextInt(minNumber, maxNumber);
		data.add(n + "");
		// System.err.println("! " + n);
		for (int i = 0; i < n; i++) {
			// System.err.println("     " + i);
			String curName = getName();

			while (used.contains(curName)) {
				curName = getName();
			}

			int curCost = getCost(i == n - 1, notStupid == -1, minCost,
					maxCost, (int) low, (int) high);
			if ((notStupid == 1 && i == 13)) {
				curCost = (int) low;
			}
			while (usedCost.contains(curCost) || curCost < 1) {
				curCost = getCost(i == n - 1, notStupid == -1, minCost,
						maxCost, (int) low, (int) high);
			}
			usedCost.add(curCost);
			used.add(curName);

			data.add(curName);
			data.add(curCost + "");
		}
		print();
	}

	boolean isOk = false;

	private int getCost(boolean isLast, boolean stupid, int minCost,
			int maxCost, int low, int high) {
		int val = nextInt(0, 3);
		isOk |= (val == 1);
		if (!isOk && isLast && stupid) {
			val = 1;
		}
		if (val == 0) {
			return nextInt(minCost, low);
		} else if (val < 3) {
			return nextInt(low + 1, high);
		} else {
			return nextInt(high + 1, maxCost);
		}

	}

	private char nextChar() {
		int pos = nextInt(32, 127);
		return (char) (pos);
	}

	private String getName() {
		String ans = "";
		int len = nextInt(10, 20);
		for (int i = 0; i < len; i++) {
			ans += nextChar();
		}
		return ans.trim();
	}

	public void run() {
		try {
			rnd = new Random(346);

			for (int i = 0; i < 4; i++) {
				genRand(SMALL / 3, SMALL, LOW / 3, LOW, -1);
			}

			for (int i = 0; i < 4; i++) {
				genRand(SMALL / 2, SMALL, LOW / 2, LOW, -1);
			}

			for (int i = 0; i < 4; i++) {
				genRand(LARGE / 2, LARGE, HIGH / 2, HIGH, -1);
			}

			while (done < 20) {
				genRand(LARGE, LARGE, HIGH / 2, HIGH, 1);
			}

		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
}
