Given a positive integer
, MoEngage wants you to determine if it is possible to rearrange the digits of (in decimal representation) and obtain a multiple of .
For example, when , we can rearrange its digits to construct which is a multiple of .
Input Format
- The first line contains an integer , the number of test cases. The description of the test cases follow.
- Each test case consists of two lines
- The first line contains a single integer , the number of digits in .
- The second line consists of a string of length , the number (in decimal representation). It is guaranteed that the string does not contain leading zeroes and consists only of the characters .
Output Format
- For each test case, print if it is possible to rearrange the digits of so that it becomes a multiple . Otherwise, print .
You may print each character of the string in uppercase or lowercase (for example, the strings , , and will all be treated as identical).
Constraints
- Sum of over all test cases .
Sample Input 1
3
3
115
3
103
3
119
Sample Output 1
Yes
Yes
No
Explanation
Test Case : The given number is already divisible by , therefore the answer is .
Test Case 2: We can obtain by rearranging the digits of , so the answer is .
Test Case 3: The only numbers that can be obtained by rearranging the digits of are . None of these numbers are multiples of , so the answer is .
No comments:
Post a Comment