NITT2 - hai jolly jolly jolly

Alp and Gaut are like always opposite to each other. Once Alp told that he can identify a number which is divisible by 252 (He knows because that is his girlfriends birthday - 25/2). Now to come up against Alp, Gaut said he can identify whether the number is divisible by 525 (poor Gaut don't have a girl friend though). The truth is they don't know to do it for big numbers. So you are here to help them with a method. Given a number you have to tell whether the number is divisible by 252 and 525.

Input

Number of testcases in first line, T (T <= 100).

Each line contains one number N, whose divisibility is to be tested (1 <= N <= 1050000).

Output

Each line containing two Yes/No. one for 252 and one for 525.

Example

Input:
4
252
525
16884
21347

Output:
Yes No
No Yes
Yes No
No No

Added by:jack(chakradarraju)
Date:2012-09-29
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2019-12-16 10:11:01
Anyone got AC using JAVA??
even faster inputs using BufferedReader gave TLE;(

AC using PYPY..

Last edit: 2019-12-16 10:19:04
2018-07-05 12:05:40
0.01 sec ;)
2016-06-17 14:02:06
A number is divisible by a composite number iff it is divisible by the highest power of each of its prime factors e.g., we can check for divisibility by 252 (252=2^2*3^2*7) by checking for divisibility by 4, 9 and 7

Last edit: 2016-06-17 14:02:35
2016-05-22 14:58:37
well the question can be done without using divisibility tests!!
2016-01-28 16:37:23 minhthai
dont bruteforce :)
2015-08-13 21:35:57 shantanu tripathi
should be moved to tutorials...
2015-05-27 21:16:46 i_am_looser
easy ;)

Last edit: 2015-05-27 21:17:02
2015-05-23 23:09:04 Vaporeon
TLE in python 2.7.9.. AC in PYPY :P
2015-02-15 22:32:46 thelazycoder
how to store 10^50000


Last edit: 2015-02-15 22:33:38
2015-01-20 03:19:52 Rajat (1307086)
nostalgic!!!
had to go through class 3 notes to revise divisibility tests.
;)
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.