Emuskald needs a fence around his farm, but he is too lazy to build it himself. So he purchased a fence-building robot.

He wants the fence to be a regular polygon. The robot builds the fence along a single path, but it can only make fence corners at a single angle a.

Will the robot be able to build the fence Emuskald wants? In other words, is there a regular polygon which angles are equal to a?


-----Input-----

The first line of input contains an integer t (0 < t < 180) — the number of tests. Each of the following t lines contains a single integer a (0 < a < 180) — the angle the robot can make corners at measured in degrees.


-----Output-----

For each test, output on a single line "YES" (without quotes), if the robot can build a fence Emuskald wants, and "NO" (without quotes), if it is impossible.


-----Examples-----
Input
3
30
60
90

Output
NO
YES
YES



-----Note-----

In the first test case, it is impossible to build the fence, since there is no regular polygon with angle $30^{\circ}$.

In the second test case, the fence is a regular triangle, and in the last test case — a square.

Difficulty: interview

Starter code:

Solutions:
import sys
my_file = sys.stdin
##my_file = open("input.txt", "r")
num = int(my_file.readline().strip("\n"))
angles = my_file.read().split()
angles = [int(i) for i in angles]
for i in angles:
    if 360%(180-i)>0:
        print("NO")
    else:
        print("YES")

for i in range (int(input())):
    print('YES' if 360 % (180 - int(input())) == 0 else 'NO')


n = int(input())
for i in range (n):
  k = 180 - int(input())
  print ("YES" if 360 % k == 0 else "NO")

n=int(input())

for i in range(n):
    a=int(input())
    if(360%(180-a)==0 and 360//(180-a)>2):
        print("YES")
    else:print("NO")


II = lambda:int(input())

n = II()
for i in range(n):
    if 360 % (180 - II()): print('NO')
    else: print('YES')


def good_angle(angle):
    exterior = 180 - angle
    if exterior == 0:
        return "NO"
    n = 360 / exterior
    if n == (int(n)):
        return "YES"
    else:
        return "NO"


def main():
    first_line = input()
    
    n = int(first_line)
    angles = []

    for i in range(n):
        angle = input()
        angles += [int(angle)]

    for a in angles:
        print(good_angle(a))
        
    


main()   


def check_polygon(angle):
    no_sides = -360 / (angle-180)
    if no_sides - int(no_sides) == 0:
        return True
    else:
        return False

testcases = []
no_testcases = int(input())
for i in range(no_testcases):
    testcases.append(int(input()))
    
for testcase in testcases:
    if check_polygon(testcase):
        print ("YES")
    else :
        print ("NO")


T=int(input())
C=[60, 90, 108, 120, 135, 140, 144, 150, 156, 160, 162, 165, 168, 170, 171, 172, 174, 175, 176, 177, 178, 179]
Ans=""
for t in range(T):
    n=int(input())
    if(n in C):
        Ans+="YES\n"
    else:
        Ans+="NO\n"
print(Ans,end="")


cases=[]
test=[60, 90, 108, 120, 135, 140, 144, 150, 156, 160, 162, 165, 168, 170, 171, 172, 174, 175, 176, 177, 178, 179]
num=int(input())
for i in range(num):
    cases.append(int(input()))



for j in range(len(cases)):
    if cases[j] in test:
        print("YES")
    else:
        print("NO")


for i in range(int(input())):print('NO' if 360%(180-int(input())) else 'YES')

n = int(input())
for i in range(n):
    a = 180 - int(input())
    if 360 % a == 0:
        print('YES')
    else:
        print('NO')



n=int(input())
z=[]
for i in range (0,n):
    x=int(input())
    n=360/(180-x)
    z.append(n)

for j in range (0,len(z)):
    if (int(z[j])==z[j]):
        print("YES")
    if (int(z[j]) !=z[j]):
        print ("NO")



def fancyfence():
    datain = []
    a = []
    for i in range(int(input())):
        datain.append(int(input()))

    for i in range(3,1000):
        a.append(((i-2)*180)/i)

    for i in datain:
        if i in a:
            print("YES")
        else:
            print("NO")
        
fancyfence()

    
  
    


for _ in range(int(input())):
    angle = int(input())
    if 60 <= angle < 180:
        if not 360 % (180 - angle):
            print('YES')
            continue
    print('NO')

p=int(input())
while p:
    n=int(input())
    if 360%(180 - n)==0:print("YES")
    else:print("NO")
    p-=1

n = int(input())
for i in range(n):
    print('NO' if 360 % (180 - int(input())) else 'YES')

def is_regular_angle(angle: int) -> int:
    return 1 if (360 % (180 - angle)) == 0 else 0

n = int(input())
messages = ['NO', 'YES']

for _ in range(n):
    print(messages[is_regular_angle(int(input()))])

t = int(input())
mnogs = [60, 90, 108, 120, 135, 140, 144, 150, 156, 160, 162, 165, 168, 170, 171, 172, 174, 175, 176, 177, 178, 179]

for i in range(t):
    if int(input()) in mnogs:
        print('YES')
    else:
        print('NO')



t = int(input())
for i in range(t):
    a = int(input())
    if 360 / (180 - a) == 360 // (180 - a):
        print("YES")
    else:
        print("NO")


i = 1;
angles = set() 
while True:
	angle = (180 * i) / (i + 2)
	if angle > 179:
		break
	if (180 * i) % (i + 2) == 0:
		angles.add(int(angle))
	i += 1
t = int(input())
for i in range(t):
	x = int(input())
	if x in angles:
		print('YES')
	else :
		print('NO')



for i in range(int(input())):
    a = int(input())
    if 360 % (180-a) == 0:
        print('YES')
    else:
        print('NO')

n = int(input())
for i in range(0, n):
    print("YES" if (360 % (180 - int(input())) == 0) else "NO")

for i in range(int(input())):
    j = 360./(180 - int(input()))
    print ('YNEOS'[bool(j - int(j))::2])

for i in range(int(input())):
    print ('YNEOS'[bool(360%(180 - int(input())))::2])

def ok(integer):
    if 360%(180-integer)==0:
        return "YES"
    else:
        return "NO"
stor=[]
sa=input()
for x in range(int(sa)):
    stor.append(ok(int(input())))
for element in stor:
    print(element)