public static void main(String[] args) {
        int[] num = new int[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
        int[] sqNum = new int[]{0, 1, 4, 9, 16, 25, 36, 49, 64, 81};
        Set<Integer> primeSet = new HashSet<Integer>() {{
            for (int p : prime) add(p);
        }};
        int[][][][] sum = new int[10][20][1500][165];
        sum[0][1][0][0] = 1;
        for (int head = 0; head < 10; head++) {
            for (int length = 1; length <= 18; length++) {
                for (int cur = 1; cur <= 9; cur++) {
                    for (int sqs = 0; sqs < 1500; sqs++) {
                        for (int s = 0; s <= 164; s++) {
                            if (sum[head][length][sqs][s] == 0)
                                continue;
                            int tmp = s + num[cur];
                            int sqTmp = sqs + sqNum[cur];
                            if (tmp > 164) break;
                            sum[head][length][sqTmp][tmp]++;
                            sum[cur][length + 1][sqTmp][tmp]++;
                        }
                    }
                }
            }
        }
        System.out.println("Finished");
        Scanner in = new Scanner(System.in);
        int t = in.nextInt();
        while (t-- > 0) {
            String str = in.nextLine();
            String a = str.split(" ")[0];
            String b = str.split(" ")[1];
            System.out.println();
        }
    }