CF2043B.Digits

传统题 时间 2000 ms 内存 256 MiB 5 尝试 1 已通过 1 标签

Digits

Artem wrote the digit dd on the board exactly n!n! times in a row. So, he got the number ddddddddddddddd \dots ddd (exactly n!n! digits).

Now he is curious about which odd digits from 11 to 99 divide the number written on the board.

Input

The first line contains a single integer tt (1t1001 \le t \le 100) — the number of test cases. The next tt test cases follow.

Each test case consists of a single line containing two integers nn and dd (2n1092 \le n \le 10^9, 1d91 \le d \le 9).

Output

For each test case, output the odd digits in ascending order that divide the number written on the board.

Note

The factorial of a positive integer nn (n!n!) is the product of all integers from 11 to nn. For example, the factorial of 55 is 12345=1201 \cdot 2 \cdot 3 \cdot 4 \cdot 5 = 120.

Samples

3
2 6
7 1
8 5
1 3 
1 3 7 9 
1 3 5 7 9 

在线编程 IDE

建议全屏模式获得最佳体验