Read problems statements in Mandarin Chinese and Russian as well. 

------ Problem description ------ 

Chef loves circular cakes. He divides them into smaller pieces and sells them. You are to help him in this work.

Today Chef has cooked the brand new circular cake. To split the cake Chef can make several (possibly, zero) cuts. Each cut should be a straight line going from the center of the cake to its border. Also, the angle between any two cuts should have positive integer value (Chef measure all the angles in degrees). Chef consider two pieces of cake equal if the appropriate angles are equal.

The picture contains two distinct pieces, and two cuts. Red part on the image shows one piece. The appropriate angle is AOB.

Chef gives to you an integer N, denoting the number of pieces Chef wants to make. You need to answer the following questions:

Is it possible to make exactly N equal pieces from the whole cake?
Is it possible to make exactly N pieces from the whole cake?
Is it possible to make exactly N pieces from the whole cake, in such a way that no two of them are equal?

------ Input ------ 

First line contains a single integer T denoting the number of test cases. Each of the following T lines contain a single integer N denoting the number of pieces Chef wants to make.

------ Output ------ 

For each test case, output one line containing 3 space separated characters.
Above, we defined the 3 questions that Chef will ask. Output 'y' for yes or 'n' for no (quotes for clarity) for each of those questions.
Answers for 3 questions (in the order above) must be space separated on the same line.

------ Constraints ------ 

$1 ≤ T ≤ 10000$
$1 ≤ N ≤ 10000$

----- Sample Input 1 ------ 
2
4
7
----- Sample Output 1 ------ 
y y y
n y y
----- explanation 1 ------ 
Example case 1.
Is it possible to make N equal pieces?
Yes, you can cut 4 pieces each with 90 degrees angle.
Is it possible to make N pieces?
Yes, you can cut 4 pieces each with 90 degrees angle.
Is it possible to make N pieces, such that no two of them are equal?
Yes, you can cut 4 pieces with angles 88, 89, 91, 92.

Source: codechef | Difficulty: MEDIUM
Tags: Geometry

Mathematics


Solutions:
n = int(input())
while n > 0:
	res = ''
	temp = int(input())
	if 360 % temp == 0:
		res = res + 'y '
	else:
		res = res + 'n '
	if temp <= 360:
		res = res + 'y '
	else:
		res = res + 'n '
	if temp * (temp + 1) / 2 <= 360:
		res = res + 'y '
	else:
		res = res + 'n '
	print(res)
	n = n - 1


import math
t = int(input())
for _ in range(t):
	ans = ''
	n = int(input())
	if 360 % n == 0:
		ans = ans + 'y '
	else:
		ans = ans + 'n '
	if n <= 360:
		ans = ans + 'y '
	else:
		ans = ans + 'n '
	if n > 26:
		ans = ans + 'n'
	else:
		ans = ans + 'y'
	print(ans)


for _ in range(int(input())):
	n = int(input())
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n < 27:
		print('y')
	else:
		print('n')


tst = int(input())
while tst is not 0:
	n = int(input())
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n > 26:
		print('n', end=' ')
	else:
		print('y', end=' ')
	print()
	tst -= 1


for _ in range(int(input())):
	n = int(input())
	if 360 % n == 0:
		a = 'y'
	else:
		a = 'n'
	if n > 360:
		b = 'n'
	else:
		b = 'y'
	if n > 26:
		c = 'n'
	else:
		c = 'y'
	print(a, b, c)


for t in range(int(input())):
	n = int(input())
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n * (n + 1) / 2 <= 360:
		print('y')
	else:
		print('n')


for _ in range(int(input())):
	n = int(input())
	s = ''
	if 360 % n == 0:
		s += 'y '
	else:
		s += 'n '
	if n <= 360:
		s += 'y '
	else:
		s += 'n '
	if n * (n + 1) // 2 <= 360:
		s += 'y'
	else:
		s += 'n'
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	s = ''
	if 360 % n == 0:
		s += 'y '
	else:
		s += 'n '
	if n < 361:
		s += 'y '
	else:
		s += 'n '
	if int(n * (n + 1) / 2) < 361:
		s += 'y'
	else:
		s += 'n'
	print(s)


for _ in range(int(input())):
	n = int(input())
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360 and n != 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 26:
		print('y', end=' ')
	else:
		print('n', end=' ')
	print()


t = int(input())
for i in range(t):
	n = int(input())
	if 360 % n == 0:
		a = 'y'
	else:
		a = 'n'
	if n <= 360:
		a1 = 'y'
	else:
		a1 = 'n'
	if n <= 26:
		a2 = 'y'
	else:
		a2 = 'n'
	print(a, a1, a2)


t = int(input())
while t > 0:
	n = int(input())
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n * (n + 1) // 2 < 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	print()
	t -= 1


for _ in range(int(input())):
	N = int(input())
	if N > 360:
		print('n n n')
	else:
		res = []
		if 360 % N == 0:
			res.append('y')
		else:
			res.append('n')
		res.append('y')
		if N * (N + 1) // 2 <= 360:
			res.append('y')
		else:
			res.append('n')
		print(*res)


n = int(input())
output = ''
for i in range(n):
	pieces = int(input())
	if 360 % pieces == 0:
		output += 'y '
	else:
		output += 'n '
	if pieces <= 360:
		output += 'y '
	else:
		output += 'n '
	if pieces > 26:
		output += 'n\n'
	else:
		output += 'y\n'
print(output)


for i in range(int(input())):
	a = int(input())
	st = ' '
	if 360 % a == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if a > 360:
		print('n', end=' ')
	else:
		print('y', end=' ')
	if a > 26:
		print('n', end=' ')
	else:
		print('y', end=' ')
	print(' ')


from bisect import bisect_left, bisect_right
import math
from bisect import bisect_left
from heapq import heapify, heappush, heappop
from collections import deque
import sys
from math import gcd, sqrt, log10, log2, floor, ceil, sqrt
from collections import deque, defaultdict
input = sys.stdin.readline

def il():
	return [int(a) for a in input().strip().split()]

def ip():
	return input().strip()

def ii():
	return int(input())

def ot(in_p, *args, e=' '):
	if type(in_p) == list:
		print(*in_p, end=e)
	if type(in_p) == str or type(in_p) == int:
		print(in_p, end=e)
		for l in args:
			print(l, end=e)
	print()

def a_pwr_n(a, n, mod):
	if n == 1:
		return a % mod
	if n % 2 == 0:
		val = a_pwr_n(a, n // 2, mod)
		return val % mod * val % mod
	else:
		return a % mod * a_pwr_n(a, n - 1, mod) % mod

def rg(*ag):
	if len(ag) == 3:
		return range(ag[0], ag[1], ag[2])
	elif len(ag) == 2:
		return range(ag[0], ag[1])
	elif len(ag) == 1:
		return range(ag[0])
	else:
		raise 'invalid input'

def ispal(i, j, st):
	while i <= j:
		if st[i] == st[j]:
			i = i + 1
			j = j - 1
		else:
			return False
	return True
mod = 1000000000 + 7
dx = [-1, -2, 1, 2, 2, -2, -1, 1]
dy = [2, 1, 2, 1, -1, -1, -2, -2]
for _ in range(ii()):
	n = ii()
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n * (n + 1) // 2 <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	print()


for num in range(int(input())):
	n = int(input())
	options = ['n', 'n', 'n']
	if n <= 360:
		options[1] = 'y'
		if 360 % n == 0:
			options[0] = 'y'
		if n < 27:
			options[2] = 'y'
	print(*options)


for i in range(int(input())):
	n = int(input())
	if n <= 360:
		a2 = 'y'
	else:
		a2 = 'n'
	if 360 / n == 360 // n:
		a1 = 'y'
	else:
		a1 = 'n'
	if n * (n + 1) / 2 <= 360:
		a3 = 'y'
	else:
		a3 = 'n'
	print(a1, a2, a3)


for _ in range(int(input())):
	n = int(input())
	if 360 % n == 0:
		a1 = 'y'
	else:
		a1 = 'n'
	if n <= 360:
		a2 = 'y'
	else:
		a2 = 'n'
	if n <= 26:
		a3 = 'y'
	else:
		a3 = 'n'
	print(a1, a2, a3)


for _ in range(int(input())):
	n = int(input())
	(f1, f2, f3) = ('n', 'n', 'n')
	if 360 % n == 0:
		f1 = 'y'
	if n <= 360:
		f2 = 'y'
	else:
		f2 = 'n'
		f1 = 'n'
	if (n + 1) * n / 2 <= 360:
		f3 = 'y'
	l = [f1, f2, f3]
	print(*l)


t = int(input())
for k in range(t):
	n = int(input())
	options = ['n', 'n', 'n']
	if 360 % n == 0:
		options[0] = 'y'
	if n <= 360:
		options[1] = 'y'
	if n < 27:
		options[2] = 'y'
	print(*options)


for _ in range(int(input())):
	N = int(input())
	s = 'n'
	t = 'n'
	u = 'n'
	if 360 % N == 0:
		s = 'y'
	if N <= 360:
		t = 'y'
	if N <= 26:
		u = 'y'
	print(s, t, u)


T = int(input())
while T > 0:
	T -= 1
	N = int(input())
	output = []
	if 360 % N == 0:
		output.append('y')
	else:
		output.append('n')
	if N <= 360:
		output.append('y')
	else:
		output.append('n')
	if N <= 26:
		output.append('y')
	else:
		output.append('n')
	print(*output)


T = int(input())
for _ in range(T):
	N = int(input())
	ans = ['n', 'n', 'n']
	if 360 % N == 0:
		ans[0] = 'y'
	if N <= 360:
		ans[1] = 'y'
	sm = N * (N + 1) / 2
	if sm <= 360:
		ans[2] = 'y'
	print(*ans)


for i in range(int(input())):
	n = int(input())
	x1 = ''
	x2 = ''
	x3 = ''
	if 360 % n == 0:
		x1 = 'y'
	else:
		x1 = 'n'
	if 360 >= n:
		x2 = 'y'
	else:
		x2 = 'n'
	if 26 >= n:
		x3 = 'y'
	else:
		x3 = 'n'
	print(x1 + ' ' + x2 + ' ' + x3)


def cake(N):
	if 360 % N == 0:
		a = 'y'
	else:
		a = 'n'
	if N > 360:
		b = 'n'
	else:
		b = 'y'
	if N > 26:
		c = 'n'
	else:
		c = 'y'
	return f'{a} {b} {c}'
T = int(input())
for i in range(T):
	N = int(input())
	print(cake(N))


for t in range(int(input())):
	n = int(input())
	a = ['n', 'n', 'n']
	if 360 % n == 0:
		a[0] = 'y'
	if n <= 360:
		a[1] = 'y'
	if n < 27:
		a[2] = 'y'
	print(*a)


for _ in range(int(input())):
	N = int(input())
	lis = []
	if 360 % N == 0:
		lis.append('y')
	else:
		lis.append('n')
	if N <= 360:
		lis.append('y')
	else:
		lis.append('n')
	if N > 26:
		lis.append('n')
	else:
		lis.append('y')
	print(' '.join(lis))


for _ in range(int(input())):
	n = int(input())
	if 360 % n:
		a = 'n'
	else:
		a = 'y'
	if 360 < n:
		b = 'n'
	else:
		b = 'y'
	if n * (n + 1) // 2 > 360:
		c = 'n'
	else:
		c = 'y'
	print(a, b, c)


t = int(input())
for _ in range(t):
	n = int(input())
	out = ''
	out += 'y ' if 360 % n == 0 else 'n '
	out += 'y ' if n <= 360 else 'n '
	out += 'y' if n <= 26 else 'n'
	print(out)


for i in range(int(input())):
	no = int(input())
	if 360 % no == 0:
		print('y ', end='')
	else:
		print('n ', end='')
	if no <= 360:
		print('y ', end='')
	else:
		print('n ', end='')
	if no <= 26:
		print('y ')
	else:
		print('n ')


for _ in range(int(input())):
	n = int(input())
	if 360 % n == 0:
		first = 'y'
	else:
		first = 'n'
	if n <= 360:
		second = 'y'
	else:
		second = 'n'
	if n > 26:
		third = 'n'
	else:
		third = 'y'
	print(f'{first} {second} {third}')


testCases = int(input())
for testCase in range(testCases):
	n = int(input())
	(f, s, t) = ('n', 'n', 'n')
	if n <= 360:
		s = 'y'
		if 360 % n == 0:
			f = 'y'
	if n * (n + 1) / 2 <= 360:
		t = 'y'
	print(f, s, t)


T = int(input())
while T:
	T -= 1
	n = int(input())
	if 360 // n == 360 / n:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 26:
		print('y')
	else:
		print('n')


t = int(input())
while t:
	n = int(input())
	r = ['0', 'y', '0']
	if n <= 26:
		r[2] = 'y'
	else:
		r[2] = 'n'
	if 360 % n == 0:
		r[0] = 'y'
	else:
		r[0] = 'n'
	if n <= 360:
		r[1] = 'y'
	else:
		r[1] = 'n'
	print(' '.join(r))
	t -= 1


import math
for x in range(int(input())):
	n = int(input())
	p = float(360 / n)
	p1 = math.floor(p)
	if p - p1 > 0:
		print('n', end=' ')
	else:
		print('y', end=' ')
	if p >= 1:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 26:
		print('y')
	else:
		print('n')


for _ in range(int(input())):
	N = int(input())
	if 360 % N == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if N <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if N <= int(pow(720, 0.5)):
		print('y')
	else:
		print('n')


t = int(input())
for _ in range(t):
	n = int(input())
	if 360 % n == 0:
		x = 'y '
	else:
		x = 'n '
	if n > 360:
		x += 'n '
	else:
		x += 'y '
	if n > 26:
		x += 'n '
	else:
		x += 'y '
	print(x[:-1])


t = int(input())
for i in range(t):
	n = int(input())
	if 360 % n == 0:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 360:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if n <= 26:
		print('y', end=' ')
	else:
		print('n', end=' ')
	if i != t - 1:
		print()


n = 360
c = 0
i = 1
while n > i:
	n -= i
	c += 1
	i += 1
for _ in range(int(input())):
	n = int(input())
	q1 = ''
	q2 = ''
	q3 = ''
	if 360 % n == 0:
		q1 = 'y'
	else:
		q1 = 'n'
	if n <= 360:
		q2 = 'y'
	else:
		q2 = 'n'
	if n <= 26:
		q3 = 'y'
	else:
		q3 = 'n'
	print(q1 + ' ' + q2 + ' ' + q3)


t = int(input())
for _ in range(t):
	n = int(input())
	(first, second, third) = ('', '', '')
	if 360 % n == 0:
		first = 'y'
	else:
		first = 'n'
	if n <= 360:
		second = 'y'
	else:
		second = 'n'
	if n * (n + 1) / 2 <= 360:
		third = 'y'
	else:
		third = 'n'
	print(first, second, third)


get_int = lambda : int(input())
get_mint = lambda : list(map(int, input().split()))
for _ in range(get_int()):
	N = get_int()
	ans = ['n', 'n', 'n']
	if N < 361:
		ans[1] = 'y'
		if 360 % N == 0:
			ans[0] = 'y'
	if N < 27:
		ans[2] = 'y'
	print(' '.join(ans))


for tc in range(int(input())):
	n = int(input())
	(f, s, t) = ('n', 'n', 'n')
	if 360 % n == 0:
		f = 'y'
	if n <= 360:
		s = 'y'
	if n < 27:
		t = 'y'
	print(f, s, t)


t = int(input())
while t > 0:
	n = int(input())
	s = ''
	if 360 % n == 0:
		s = s + 'y '
	else:
		s = s + 'n '
	if n < 361:
		s = s + 'y '
	else:
		s = s + 'n '
	if n <= 26:
		s = s + 'y'
	else:
		s = s + 'n'
	print(s)
	t = t - 1


tests = int(input())
for i in range(tests):
	pieces = int(input())
	if 360 % pieces == 0:
		one = 'y'
	else:
		one = 'n'
	if pieces <= 360:
		two = 'y'
	else:
		two = 'n'
	if pieces * (pieces + 1) // 2 <= 360:
		three = 'y'
	else:
		three = 'n'
	print(one, two, three)