#P7830. Divisibility
Divisibility
Divisibility
Problem Description
You are given two -based integers and , and you are required to determine the following proposition is true or false: For arbitrary -based positive integer ( is the -th dight from left of ), define , if can be divided by , then can be divided by , otherwise can't be divided by .
Input
The first line contains a -based integer — the number of test cases. For each test case, there is a single line containing two -based integers and .
Output
For each test case, if the proposition is true, print "T", otherwise print "F" (without quotes).
Sample Input
1
10 3
Sample Output
T
Source
2020 Multi-University Training Contest 6