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

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

	int testNum = 0;
	static Random rand = new Random(3);

	class Test {
		String s;
		int k;

		public Test(String s, int k) {
			this.s = s;
			this.k = k;
		}

	}

	void printTest(Test test) {
		try {
			++testNum;
			PrintWriter out = new PrintWriter("" + (testNum / 10)
					+ (testNum % 10));
			out.println(test.k);
			out.println(test.s);
			System.err.println("Generated test #" + testNum);
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	void run() {
		printTest(new Test("4598", 2));
		printTest(new Test("888", 3));
		final int[] N = { 2, 3, 4, 7, 8, 9, 10, 15, 40, 75, 80, 100, 260, 400,
				600, 900, 1000, 2000, 5000, 7000, 10000, 20000, 30000, 50000,
				60000, 70000 };
		printTest(new Test("04", 4));
		printTest(new Test("04761", 4));
		printTest(new Test("08778", 1));
		printTest(genRandomTest(1, 12));
		printTest(genNoSolutionTest(1, 1));
		printTest(genRandomTest(5, 3));
		printTest(genNoSolutionTest(5, 10));
		printTest(genRandomTest(99999, 99));
		printTest(genRandomTest(100000, 100));
		printTest(genTLTest1(100000, 100, 0, 1, 99999));
		printTest(genTLTest1(99999, 99, 10, 100, 99889));
		printTest(genNoSolutionTest(100000, 60));
		printTest(genNoSolutionTest(99999, 1));
		for (int i = 0; i < 26; i++) {
			if (i < 20) {
				printTest(genRandomTest(N[i], (int) Math.sqrt(i + 1)
						* rand.nextInt(20) + 1));
				printTest(genNoSolutionTest(N[i], (int) Math.sqrt(i + 1)
						* rand.nextInt(20) + 1));
			} else {
				printTest(genRandomTest(N[i], rand.nextInt(10) + 91));
				printTest(genNoSolutionTest(N[i], rand.nextInt(10) + 91));
				int x = rand.nextInt(N[i]);
				int y = rand.nextInt(N[i] - x);
				int z = N[i] - x - y;
				printTest(genTLTest1(N[i], rand.nextInt(10) + 91, x, y, z));
			}
		}
	}

	Test genRandomTest(int n, int k) {
		return new Test(genRandomNumber(n), k);
	}

	Test genTLTest1(int n, int k, int n0, int n1, int n8) {
		if (n != n8 + n1 + n0) {
			throw new AssertionError("invalid args");
		}
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n0; ++i) {
			sb.append("0");
		}
		for (int i = 0; i < n1; ++i) {
			sb.append("1");
		}
		for (int i = 0; i < n8; ++i) {
			sb.append("8");
		}
		return new Test(sb.toString(), k);
	}

	Test genNoSolutionTest1(int n, int k) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append("1");
		}
		return new Test(sb.toString(), k);
	}

	Test genNoSolutionTest2(int n, int k) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append("8");
		}
		return new Test(sb.toString(), k);
	}

	Test genNoSolutionTest3(int n, int k) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append("9");
		}
		return new Test(sb.toString(), k);
	}

	Test genNoSolutionTest4(int n, int k) {
		StringBuilder sb = new StringBuilder();
		int m = rand.nextInt(n) + 1;
		for (int i = 0; i < m; i++) {
			sb.append("9");
		}
		for (int i = m; i < n; i++) {
			sb.append("8");
		}
		return new Test(sb.toString(), k);
	}

	Test genNoSolutionTest(int n, int k) {
		int test = rand.nextInt(4);
		if (test == 0) {
			return genNoSolutionTest1(n, k);
		} else if (test == 1) {
			return genNoSolutionTest2(n, k);
		} else if (test == 2) {
			return genNoSolutionTest3(n, k);
		} else {
			return genNoSolutionTest4(n, k);
		}
	}

	String genRandomNumber(int n) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
			sb.append(rand.nextInt(10));
		}
		return sb.toString();
	}

}