you-just-went-full-retard-never-go-full-retard-1_28729
Mr. Retardo has lost his marbles. He's a professor, and absolutely loathes his students. And since going full retard, he asks them all sorts of useless questions. His latest obsession is prime numbers, and he gives all his a students random number n and asks them to check if it is prime. 
Check if it is!!

Note that the permitted language list for this problem has been altered. Please check before solving.

EDIT

Maximum number of test cases - 500,
0 ≤ n ≤ 5*10^9

SAMPLE INPUT
5

2
3
4
5
6

SAMPLE OUTPUT
YES
YES
NO
YES
NO
from math import sqrt

def is_prime(n):
  if n == 2 or n == 3: return True
  if n < 2 or n%2 == 0: return False
  if n < 9: return True
  if n%3 == 0: return False
  r = int(sqrt(n))
  f = 5
  while f <= r:
    if n%f == 0: return False
    if n%(f+2) == 0: return False
    f +=6
  return True

for _ in xrange(input()):
	s=raw_input()
	while s=="":
		s=raw_input()
	if is_prime(int(s)):
		print "YES"
	else:
		print "NO"
5

2
3
4
5
6

SAMPLE 10

9223372036854775807
104729
103141
99999989
9563494117
8670344929
11812315811854
828456218949862
0
12198789456 10

9223372036854775807
104729
103141
99999989
9563494117
8670344929
11812315811854
828456218949862
0
13536397441 5

2
3
8
5
6

SAMPLE 10

9223372036854775807
56688
103141
99999989
9563494117
8670344929
11812315811854
828456218949862
0
13536397441 10

9223372036854775807
56688
7795
99999989
9563494117
8670344929
11812315811854
828456218949862
0
13536397441 5

2
4
9
5
10

SAMPLE 10

9223372036854775807
25104
7795
99999989
14233477817
8670344929
11812315811854
828456218949862
0
2284133286 10

9223372036854775807
25104
7795
111652060
14233477817
8670344929
11812315811854
828456218949862
0
2284133286 10

9223372036854775807
28949
7795
43662248
14233477817
8670344929
21539267824431
828456218949862
0
329202230 10

9223372036854775807
28949
7795
43662248
14233477817
12349760801
21539267824431
828456218949862
0
329202230 10

7627904653845779240
14746
7795
30363507
14233477817
12349760801
21539267824431
828456218949862
0
442942614 10

14223968993135099914
11813
7795
21613777
14233477817
12349760801
21539267824431
828456218949862
0
442942614 5

2
3
2
5
6

SAMPLE 5

2
3
12
8
10

SAMPLE 5

2
4
9
5
13

ELPMAS 10

14223968993135099914
23103
4894
21613777
14233477817
12349760801
21539267824431
1337429752643205
0
442942614 5

2
0
8
9
6

SAMPLE 5

2
8
13
5
9

ELPMAS 5

2
4
9
4
13

ELPMAS 10

9223372036854775807
104729
103141
99999989
267362333
8670344929
11812315811854
828456218949862
0
20003584376 5

2
3
7
3
5

SAMPLE 10

9223372036854775807
25104
7795
99999989
9563494117
8670344929
2434896257929
828456218949862
0
660709391 10

6714514577839312392
11813
7795
17793286
19386847717
12349760801
21539267824431
828456218949862
0
175356581 10

9223372036854775807
104729
116708
99999989
267362333
8670344929
11812315811854
828456218949862
0
20003584376 10

9223372036854775807
25104
7795
99999989
17169976576
8670344929
2434896257929
828456218949862
0
660709391 5

2
9
13
10
9

ELPMAS 5

0
4
18
0
9

SAMPME 10

12624852340856598420
110474
103141
99999989
9563494117
436449092
11812315811854
1150736693067760
0
13536397441 5

2
6
7
2
5

SAMPLE 5

4
9
9
5
9

SAMPLE 5

2
6
7
4
5

SAMPLE 10

9223372036854775807
1404
14724
15726922
9563494117
8670344929
11812315811854
67708072729256
0
1657032500 10

9223372036854775807
38589
6037
99999989
17169976576
8670344929
2434896257929
828456218949862
0
660709391 10

9223372036854775807
1404
14724
15726922
9563494117
10510785634
11812315811854
67708072729256
0
1657032500 10

7414479999246321013
28949
3319
53761036
41040555144
12349760801
21539267824431
759420598951429
0
444298682 5

4
8
9
5
17

SBMPLE 10

9223372036854775807
1404
20023
15726922
9563494117
10510785634
11812315811854
67708072729256
0
1657032500 10

7414479999246321013
10347
3319
53761036
41040555144
12349760801
21539267824431
759420598951429
0
444298682 10

8915801759762282082
14669
6037
99999989
17169976576
8670344929
2434896257929
828456218949862
0
660709391 10

8915801759762282082
14669
6037
99999989
17169976576
6083161482
2434896257929
828456218949862
0
307896543 5

0
10
5
0
0

REMPMA 5

2
2
43
6
15

S@LPLE 5

4
8
17
5
3

EBNPLS 5

4
9
8
10
17

EMPMAS 5

3
5
12
5
3

EBNPLS 10

9223372036854775807
25104
7795
99999989
9563494117
14422588167
11812315811854
828456218949862
0
1657032500 10

9223372036854775807
56688
103141
99999989
9563494117
8670344929
11812315811854
1150736693067760
0
5576340839 10

9223372036854775807
56688
103141
156812778
9563494117
1933841197
11812315811854
1150736693067760
0
13536397441 5

4
3
7
2
5

SAMPLE 10

9223372036854775807
25104
7795
99999989
17169976576
3346738469
2434896257929
828456218949862
0
660709391 10

16525389788495421828
13287
4387
29127734
14233477817
32538527443
21539267824431
828456218949862
0
499417939 10

9223372036854775807
38589
6037
99999989
17169976576
8670344929
2434896257929
828456218949862
0
1150695630 10

9223372036854775807
16760
4357
99999989
17793996448
3813153342
5886058174684
166346527727715
0
2576062093 10

9223372036854775807
1404
20023
28149586
9563494117
10510785634
11812315811854
2443710385871
0
1657032500 5

4
11
8
10
26

EMPMAS 10

9223372036854775807
104729
103141
95904880
9563494117
8670344929
11812315811854
828456218949862
0
1319923808 5

4
3
9
5
15

SAMPLE 10

9223372036854775807
25104
7795
99999989
9563494117
10237463378
11812315811854
828456218949862
0
2835587281 5

4
5
17
5
10

ELPMAS 10

24609305032352274899
11813
4894
21613777
14233477817
12349760801
36495303065773
1337429752643205
0
442942614 10

9223372036854775807
56688
103141
156812778
14357266463
1933841197
11812315811854
1150736693067760
0
13536397441 5

0
8
13
5
9

SAMPLE 5

3
5
9
4
3

ESPMAL 5

2
3
12
5
6

SAMPLE 5

2
3
12
5
10

SAMPLE 10

9223372036854775807
25104
7795
99999989
9563494117
8670344929
11812315811854
828456218949862
0
13536397441 5

2
3
9
5
10

SAMPLE 10

9223372036854775807
25104
7795
99999989
9563494117
8670344929
11812315811854
828456218949862
0
1657032500 10

9223372036854775807
25104
7795
99999989
9563494117
8670344929
11812315811854
828456218949862
0
2284133286 5

2
5
9
5
10

SAMPLE 5

2
5
9
5
10

ELPMAS 5

2
4
9
5
10

ELPMAS 10

9223372036854775807
25104
7795
52841455
14233477817
8670344929
11812315811854
828456218949862
0
2284133286 5

2
4
9
5
9

ELPMAS 10

9223372036854775807
25104
7795
52841455
14233477817
8670344929
11812315811854
828456218949862
0
329202230 5

2
4
18
5
9

ELPMAS 10

9223372036854775807
25104
7795
52841455
14233477817
8670344929
21539267824431
828456218949862
0
329202230 5

2
4
14
5
9

ELPMAS 10

9223372036854775807
25104
7795
43662248
14233477817
8670344929
21539267824431
828456218949862
0
329202230 5

2
4
14
5
9

ELPMAT 10

16525389788495421828
28949
7795
43662248
14233477817
12349760801
21539267824431
828456218949862
0
329202230 10

25227645245024564804
28949
7795
43662248
14233477817
12349760801
21539267824431
828456218949862
0
329202230 10

7627904653845779240
28949
7795
43662248
14233477817
12349760801
21539267824431
828456218949862
0
329202230 10

7627904653845779240
28949
7795
43662248
14233477817
12349760801
21539267824431
828456218949862
0
477777217 10

7627904653845779240
28949
7795
43662248
14233477817
12349760801
21539267824431
828456218949862
0
442942614 10

7627904653845779240
28949
7795
30363507
14233477817
12349760801
21539267824431
828456218949862
0
442942614 10

7627904653845779240
14746
7795
17793286
14233477817
12349760801
21539267824431
828456218949862
0
442942614 10

14223968993135099914
14746
7795
17793286
14233477817
12349760801
21539267824431
828456218949862
0
442942614 10

14223968993135099914
11813
7795
17793286
14233477817
12349760801
21539267824431
828456218949862
0
442942614 10

14223968993135099914
11813
7795
21613777
14233477817
12349760801
21539267824431
1337429752643205
0
442942614 10

14223968993135099914
11813
4894
21613777
14233477817
12349760801
21539267824431
1337429752643205
0
442942614 10

9223372036854775807
104729
103141
99999989
9563494117
8670344929
11812315811854
828456218949862
0
13165132033 10

9223372036854775807
104729
103141
99999989
9563494117
8670344929
11812315811854
828456218949862
0
14674563001 5

2
0
8
5
6

SAMPLE 10

9223372036854775807
56688
103141
99999989
9563494117
8670344929
11812315811854
1150736693067760
0
13536397441 5

2
3
7
5
6

SAMPLE 10

9223372036854775807
56688
3995
99999989
9563494117
8670344929
11812315811854
828456218949862
0
13536397441 10

9223372036854775807
25104
7795
99999989
9563494117
8670344929
11812315811854
828456218949862
0
25428932415 5

2
3
9
5
9

SAMPLE 10

9223372036854775807
25104
7795
18818539
9563494117
8670344929
11812315811854
828456218949862
0
1657032500 5

2
4
9
5
10

S@MPLE
YES
YES
NO
YES
NO
 NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
 NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
 YES
YES
NO
YES
NO
 NO
NO
YES
YES
YES
YES
NO
NO
NO
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
 NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
 NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
 NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
 YES
YES
YES
YES
NO
 YES
YES
NO
NO
NO
 YES
NO
NO
YES
YES
 NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
 YES
NO
NO
NO
NO
 YES
NO
YES
YES
NO
 YES
NO
NO
NO
YES
 NO
YES
YES
YES
NO
YES
NO
NO
NO
NO
 YES
YES
YES
YES
YES
 NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
 NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
 NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
 NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
 YES
NO
YES
NO
NO
 NO
NO
NO
NO
NO
 NO
NO
YES
YES
YES
NO
NO
NO
NO
NO
 YES
NO
YES
YES
YES
 NO
NO
NO
YES
NO
 YES
NO
YES
NO
YES
 NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
 NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
 NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
 NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
 NO
NO
NO
YES
YES
 NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
 NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
 NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
 NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
 NO
NO
YES
NO
NO
 YES
YES
YES
NO
NO
 NO
NO
YES
YES
YES
 NO
NO
NO
NO
YES
 YES
YES
NO
YES
YES
 NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
 NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
 NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
 NO
YES
YES
YES
YES
 NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
 NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
 NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
 NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
 NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
 NO
YES
NO
NO
NO
 NO
YES
YES
NO
YES
YES
NO
NO
NO
NO
 NO
YES
NO
YES
NO
 NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
 NO
YES
YES
YES
NO
 NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
 NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
 NO
NO
YES
YES
NO
 YES
YES
NO
NO
YES
 YES
YES
NO
YES
NO
 YES
YES
NO
YES
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 YES
YES
NO
YES
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 YES
YES
NO
YES
NO
 YES
YES
NO
YES
NO
 YES
NO
NO
YES
NO
 NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
 NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
 NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
 NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
 NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
 NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
 NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
 NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
 NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
 NO
NO
YES
YES
YES
YES
NO
NO
NO
NO
 YES
YES
YES
YES
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 YES
YES
NO
YES
NO
 NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
 YES
NO
NO
YES
NO
