You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.
According to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:
 - All even numbers written on the document are divisible by 3 or 5.
If the immigrant should be allowed entry according to the regulation, output APPROVED; otherwise, print DENIED.

-----Notes-----
 - The condition in the statement can be rephrased as "If x is an even number written on the document, x is divisible by 3 or 5".
Here "if" and "or" are logical terms.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 100
 - 1 \leq A_i \leq 1000

-----Input-----
Input is given from Standard Input in the following format:
N
A_1 A_2 \dots A_N

-----Output-----
If the immigrant should be allowed entry according to the regulation, print APPROVED; otherwise, print DENIED.

-----Sample Input-----
5
6 7 9 10 31

-----Sample Output-----
APPROVED

The even numbers written on the document are 6 and 10.
All of them are divisible by 3 or 5, so the immigrant should be allowed entry.

Difficulty: EASY

Solutions:
n = int(input())
a = [int(x) for x in input().split()]
flag = True
for x in a:
	if x % 2 == 0:
		if x % 3 and x % 5:
			flag = False
if flag:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
a = map(int, input().split())
for i in a:
	if i % 2 == 0:
		if i % 3 == 0 or i % 5 == 0:
			continue
		else:
			print('DENIED')
			return
print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
result = 'APPROVED'
for i in A:
	if i % 2 == 0 and (not (i % 3 == 0 or i % 5 == 0)):
		result = 'DENIED'
		break
print(result)


def main():
	n = int(input())
	a = [int(v) for v in input().split()]
	for i in range(len(a)):
		if a[i] % 2 == 0:
			if a[i] % 3 == 0 or a[i] % 5 == 0:
				continue
			else:
				return 'DENIED'
	return 'APPROVED'

def __starting_point():
	print(main())
__starting_point()


N = int(input())
A = list(map(int, input().split()))
ans = True
for i in A:
	if i % 2 == 0 and (not (i % 3 == 0 or i % 5 == 0)):
		ans = False
		break
print('APPROVED' if ans else 'DENIED')


n = int(input())
a = list(map(int, input().split()))
j = 'APPROVED'
for i in a:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			j = 'DENIED'
print(j)


N = int(input())
A = list(map(int, input().split()))
judge = 'APPROVED'
for Ai in A:
	if Ai % 2 == 0:
		if Ai % 6 != 0 and Ai % 10 != 0:
			judge = 'DENIED'
			break
print(judge)


N = int(input())
List = list(map(int, input().split()))
List_2 = list(filter(lambda x: x % 2 == 0, List))
answer = 'APPROVED'
for x in List_2:
	if x % 3 != 0 and x % 5 != 0:
		answer = 'DENIED'
print(answer)


(N,) = map(int, input().split())
A = map(int, input().split())
for i in A:
	if i % 2 == 0 and (not (i % 3 == 0 or i % 5 == 0)):
		print('DENIED')
		return
print('APPROVED')


n = int(input())
lst = list(map(int, input().split()))
a = list()
count = 0
for i in range(n):
	if lst[i] % 2 == 0:
		a.append(lst[i])
for i in range(len(a)):
	if a[i] % 3 == 0 or a[i] % 5 == 0:
		count += 1
if count == len(a):
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = input().split()
result = ''
for i in range(N):
	A[i] = int(A[i])
	if A[i] % 2 == 0:
		if A[i] % 3 != 0 and A[i] % 5 != 0:
			result = 'DENIED'
			break
	else:
		result = 'APPROVED'
print(result)


n = int(input())
a = list(map(int, input().split()))
check = True
for i in range(n):
	if a[i] % 2 == 0:
		if a[i] % 3 != 0 and a[i] % 5 != 0:
			check = False
print('APPROVED' if check else 'DENIED')


cnt = int(input())
num_list = [num for num in map(int, input().split()) if num % 2 == 0]
for _ in num_list:
	if _ % 3 == 0 or _ % 5 == 0:
		continue
	else:
		print('DENIED')
		break
else:
	print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
a = [i for i in A if i % 2 == 0]
b = len([i for i in a if i % 3 == 0 or i % 5 == 0])
if len(a) == b:
	print('APPROVED')
else:
	print('DENIED')


import sys
N = int(input())
A = [int(n) for n in input().split()]
for i in range(N):
	if A[i] % 2 == 0:
		if A[i] % 3 == 0 or A[i] % 5 == 0:
			continue
		else:
			print('DENIED')
			return
print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
for i in range(N):
	if A[i] % 2 == 0 and (A[i] % 3 == 0 or A[i] % 5 == 0):
		continue
	elif A[i] % 2 == 1:
		continue
	else:
		print('DENIED')
		return
print('APPROVED')


n = int(input())
a = list(map(int, input().split()))
flag = True
for i in a:
	if i % 2 == 0:
		if not (i % 3 == 0 or i % 5 == 0):
			flag = False
			break
print('APPROVED' if flag else 'DENIED')


input()
A = list(map(int, input().split()))
print('APPROVED' if all((a & 1 or a % 3 == 0 or a % 5 == 0 for a in A)) else 'DENIED')


n = int(input())
a = list(map(int, input().split()))
b = 0
for i in range(0, n):
	if a[i] % 2 == 0:
		if a[i] % 3 == 0 or a[i] % 5 == 0:
			b += 1
		else:
			b -= 1000
if b >= 0:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = list(map(int, input().split()))
approved = all([a % 2 == 1 or a % 6 == 0 or a % 10 == 0 for a in A])
print('APPROVED' if approved else 'DENIED')


N = int(input())
A = list(map(int, input().split()))
ans = 0
n = 0
for i in range(N):
	if A[i] % 2 == 0:
		n += 1
		if A[i] % 3 == 0 or A[i] % 5 == 0:
			ans += 1
		else:
			ans = 0
if ans == n:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = list(map(int, input().split()))
evens = [num for num in A if num % 2 == 0]
bool_list = [even % 3 == 0 or even % 5 == 0 for even in evens]
result = all(bool_list)
print('APPROVED' if result else 'DENIED')


n = int(input())
l = list(map(int, input().split()))
mod_check = 0
mod_check_ = 0
for i in l:
	if i % 2 == 0:
		mod_check += 1
		if i % 3 == 0 or i % 5 == 0:
			mod_check_ += 1
		else:
			pass
	else:
		pass
print('APPROVED') if mod_check == mod_check_ else print('DENIED')


N = int(input())
Alist = list(map(int, input().split()))
num = 0
for i in range(N):
	if Alist[i] % 2 == 0:
		num += 1
		if Alist[i] % 3 == 0 or Alist[i] % 5 == 0:
			num -= 1
if num == 0:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	no = a[i]
	if no % 2 == 0 and no % 3 != 0 and (no % 5 != 0):
		print('DENIED')
		return
print('APPROVED')


N = int(input())
A = []
A = [int(x) for x in input().split()]
for i in range(len(A)):
	if A[i] % 2 == 1:
		A[i] = 'YES'
	elif A[i] % 2 == 0 and A[i] % 3 != 0 and (A[i] % 5 != 0):
		A[i] = 'NO'
	else:
		A[i] = 'YES'
if 'NO' in A:
	print('DENIED')
else:
	print('APPROVED')


n = int(input())
a = list(map(int, input().split()))
a_ = [i for i in a if i % 2 == 0]
for i in a_:
	bool_3 = i % 3 != 0
	bool_5 = i % 5 != 0
	if bool_3 and bool_5:
		print('DENIED')
		break
else:
	print('APPROVED')


import sys
N = int(input())
A = list(map(int, input().split()))
for num in A:
	if num % 2 == 0:
		if not (num % 3 == 0 or num % 5 == 0):
			print('DENIED')
			return
print('APPROVED')


n = int(input())
integer_list = list(map(int, input().split()))
even_list = list()
approve_counts = 0
for i in integer_list:
	if i % 2 == 0:
		even_list.append(i)
for j in even_list:
	if j % 3 == 0 or j % 5 == 0:
		approve_counts += 1
if approve_counts == len(even_list):
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
my_list = list(input().split())
j = 0
for i in range(0, N):
	if int(my_list[i]) % 2 == 0:
		if int(my_list[i]) % 3 != 0 and int(my_list[i]) % 5 != 0:
			j += 1
if j != 0:
	print('DENIED')
else:
	print('APPROVED')


n = int(input())
A = map(int, input().split())
flag = True
for a in A:
	if a % 2 != 0:
		continue
	if a % 3 != 0 and a % 5 != 0:
		flag = False
		break
print('APPROVED' if flag else 'DENIED')


n = int(input())
a = list(map(int, input().split()))
z = 1
for i in a:
	if i % 2 == 0:
		if not (i % 3 == 0 or i % 5 == 0):
			z = 0
			break
print('APPROVED' if z == 1 else 'DENIED')


import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
A = A[A % 2 == 0]
if np.all((A % 3 == 0) | (A % 5 == 0)) == True:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
a = [int(o) for o in input().split()]
ok = True
for i in range(n):
	if a[i] % 2:
		continue
	if a[i] % 3 != 0 and a[i] % 5 != 0:
		ok = False
print('APPROVED' if ok else 'DENIED')


N = int(input())
A = list(map(int, input().split()))
for a in A:
	if a % 2 == 1:
		continue
	if a % 3 == 0 or a % 5 == 0:
		continue
	print('DENIED')
	return
print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
review_result = 'APPROVED'
for i in A:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			review_result = 'DENIED'
			break
		else:
			review_result = 'APPROVED'
print(review_result)


n = int(input())
l1 = list(map(int, input().split()))
l2 = []
cnt = 0
for i in l1:
	if i % 2 == 0:
		l2.append(i)
		cnt += 1
for i in l2:
	if i % 3 != 0 and i % 5 != 0:
		print('DENIED')
		return
print('APPROVED')


def resolve():
	n = int(input())
	a = tuple(map(int, input().split()))
	ans = 'APPROVED'
	for i in a:
		if i % 2:
			continue
		if i % 3 != 0 and i % 5 != 0:
			ans = 'DENIED'
	print(ans)
resolve()


N = int(input())
A = list(map(int, input().split()))
ans = 'APPROVED'
for i in range(N):
	if A[i] % 2 != 0:
		continue
	elif A[i] % 6 != 0 and A[i] % 10 != 0:
		ans = 'DENIED'
		break
print(ans)


y = int(input())
a = list(map(int, input().split()))
res = 'APPROVED'
for i in a:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			res = 'DENIED'
print(res)


n = int(input())
a = list(map(int, input().split()))
flg = 0
for i in a:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			flg = 1
if flg:
	print('DENIED')
else:
	print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
gusu = 0
cnt = 0
for i in range(N):
	if A[i] % 2 == 0:
		gusu += 1
		if A[i] % 3 == 0 or A[i] % 5 == 0:
			cnt += 1
if gusu == cnt:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = list(map(int, input().split()))
even = []
approved = 0
for i in A:
	if i % 2 == 0:
		even.append(i)
for x in even:
	if x % 3 == 0 or x % 5 == 0:
		approved += 1
if approved == len(even):
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
a = list(map(int, input().split()))
ans = True
for i in range(0, n):
	if a[i] % 2 != 0:
		continue
	if a[i] % 3 == 0 or a[i] % 5 == 0:
		continue
	ans = False
if ans:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
a = list(map(int, input().split()))
for i in range(n):
	if a[i] % 2 == 0:
		if a[i] % 3 != 0 and a[i] % 5 != 0:
			print('DENIED')
			break
else:
	print('APPROVED')


n = int(input())
nums = list(map(int, input().split()))
evens = [num for num in nums if num % 2 == 0]
approved = all([even % 3 == 0 or even % 5 == 0 for even in evens])
print('APPROVED ' if approved else 'DENIED')


N = int(input())
A = list(map(int, input().split()))
t = 'APPROVED'
for i in range(len(A)):
	if A[i] % 2 == 0:
		if A[i] % 3 == 0 or A[i] % 5 == 0:
			continue
		else:
			t = 'DENIED'
print(t)


def atc_155b(input_value: str) -> str:
	N = int(input_value[0])
	Ai = [int(ai) for ai in input_value[1].split(' ')]
	for i in range(0, N):
		if Ai[i] % 2 == 0 and Ai[i] % 3 != 0 and (Ai[i] % 5 != 0):
			return 'DENIED'
	return 'APPROVED'
N = input()
Ai = input()
print(atc_155b([N, Ai]))


import sys
sys.setrecursionlimit(10 ** 7)
from collections import deque
import math
n = int(input())
a = [int(x) for x in input().strip().split()]
ok = True
for x in a:
	if x & 1 == 0:
		ok = ok and (x % 3 == 0 or x % 5 == 0)
if ok:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
a = list(map(int, input().split()))
print('APPROVED' if all((a_ % 3 == 0 or a_ % 5 == 0 for a_ in a if a_ % 2 == 0)) else 'DENIED')


def solve():
	N = int(input())
	A = [int(i) for i in list(input().split())]
	for a in A:
		if a % 2 == 0:
			if not (a % 3 == 0 or a % 5 == 0):
				print('DENIED')
				return
	print('APPROVED')
solve()


n = int(input())
aa = list(map(int, input().split()))
for a in aa:
	if a % 2 == 0 and a % 3 != 0 and (a % 5 != 0):
		print('DENIED')
		return
print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
print('ADPEPNRIOEVDE D'[any((a % 2 * 8 - a % 3 * a % 5 < 0 for a in A))::2])


n = int(input())
a = list(map(int, input().split()))
res = 'APPROVED'
for num in a:
	if num % 2 == 0:
		if num % 3 != 0 and num % 5 != 0:
			res = 'DENIED'
			break
print(res)


N = int(input())
A = [int(i) for i in input().split()]
for i in range(N):
	if A[i] % 2 == 0:
		if A[i] % 3 != 0 and A[i] % 5 != 0:
			print('DENIED')
			return
print('APPROVED')


N = int(input())
A = list(map(int, input().split()))
d = {'A': 0, 'D': 0}
for number in A:
	if number % 2 == 0:
		if number % 3 == 0 or number % 5 == 0:
			d['A'] += 1
		else:
			d['D'] += 1
	else:
		d['A'] += 1
if d['D'] > 0:
	print('DENIED')
else:
	print('APPROVED')


n = int(input())
A = list(map(int, input().split()))
isOk = True
for i in range(n):
	if A[i] % 2 != 0:
		continue
	if A[i] % 3 != 0 and A[i] % 5 != 0:
		isOk = False
if isOk:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
al = list(map(int, input().split()))
for i in al:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			print('DENIED')
			return
print('APPROVED')


n = int(input())
a = [int(i) for i in input().split()]
q = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		if a[i] % 3 == 0 or a[i] % 5 == 0:
			q += 1
	else:
		q += 1
if q == len(a):
	print('APPROVED')
else:
	print('DENIED')


input()
a = [a for a in map(int, input().split()) if a % 2 == 0]
r = 'DENIED'
for i in a:
	if i % 3 and i % 5:
		break
else:
	r = 'APPROVED'
print(r)


n = int(input())
a = input()
a = a.split()
c = 0
for b in range(n):
	if int(a[b]) % 3 == 0 or int(a[b]) % 5 == 0 or int(a[b]) % 2 == 1:
		c = c + 1
if c == n:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = list(map(int, input().split()))
j = 0
for i in A:
	if i % 2 == 0:
		if i % 3 == 0 or i % 5 == 0:
			pass
		else:
			j += 1
	else:
		pass
if j > 0:
	print('DENIED')
else:
	print('APPROVED')


n = int(input())
a = list(map(int, input().split()))
result = 0
for i in a:
	if i % 2 == 0:
		if i % 3 == 0 or i % 5 == 0:
			result = 'APPROVED'
		else:
			result = 'DENIED'
			break
	else:
		result = 'APPROVED'
print(result)


N = int(input())
list1 = list(map(int, input().split()))
list2 = []
for i in list1:
	if i % 2 == 0:
		list2.append(i)
	else:
		continue
list3 = []
for j in list2:
	if j % 3 == 0 or j % 5 == 0:
		list3.append(j)
	else:
		continue
x = len(list2)
y = len(list3)
if x == y:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = list(map(int, input().split()))
j = 0
k = 0
for i in A:
	if i % 2 == 0:
		k = k + 1
		if i % 3 == 0:
			j = j + 1
		elif i % 5 == 0:
			j = j + 1
if k == j:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
An = list(map(int, input().split()))
ans = True
for i in An:
	if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
		ans = False
if ans:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = input().split()
num_even = 0
num_approved = 0
for i in range(N):
	if int(A[i]) % 2 == 0:
		num_even += 1
		if int(A[i]) % 3 == 0 or int(A[i]) % 5 == 0:
			num_approved += 1
if num_even == num_approved:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
num_list = list(map(int, input().split()))
bool = True
for i in range(n):
	x = num_list[i]
	if x % 2 == 0:
		bool = True
		if x % 3 != 0 and x % 5 != 0:
			bool = False
			break
if bool:
	print('APPROVED')
else:
	print('DENIED')


n = int(input())
(*A,) = list(map(int, input().split()))
ans = 'APPROVED'
for a in A:
	if a % 2 == 0 and a % 3 and a % 5:
		ans = 'DENIED'
print(ans)


N = int(input())
A = list(map(int, input().split()))
answers = []
for a in A:
	if a % 2 == 0:
		if a % 3 == 0 or a % 5 == 0:
			answer = 'APPROVED'
			answers.append(answer)
		else:
			answer = 'DENIED'
			answers.append(answer)
if 'DENIED' in answers:
	print('DENIED')
else:
	print('APPROVED')


input()
print(['DENIED', 'APPROVED'][all(([1, i % 3 == 0 or i % 5 == 0][i % 2 == 0] for i in map(int, input().split())))])


n = int(input())
arr = list(map(int, input().split()))
for k in arr:
	if k % 2 == 0:
		if k % 3 != 0 and k % 5 != 0:
			print('DENIED')
			return
print('APPROVED')


flag = True
n = int(input())
l = list(map(int, input().split()))
for _ in range(n):
	for num in l:
		if num % 2 == 0:
			if num % 3 == 0 or num % 5 == 0:
				pass
			else:
				flag = False
				break
if flag:
	print('APPROVED')
else:
	print('DENIED')


N = int(input())
A = list(map(int, input().split()))
result = 'APPROVED'
for n in A:
	if n % 2 == 0:
		if not (n % 3 == 0 or n % 5 == 0):
			result = 'DENIED'
print(result)


N = int(input())
num = list(map(int, input().split()))
even = []
for i in range(N):
	if num[i] % 2 == 0:
		even.append(num[i])
for j in range(len(even)):
	if even[j] % 5 != 0 and even[j] % 3 != 0:
		print('DENIED')
		return
print('APPROVED')


n = int(input())
anums = list(map(int, input().split()))
result = 'APPROVED'
for anum in anums:
	if anum % 2 == 0 and (not (anum % 3 == 0 or anum % 5 == 0)):
		result = 'DENIED'
		break
print(result)


n = int(input())
a = list(map(int, input().split()))
ans = 'APPROVED'
for i in a:
	if i % 2 != 0:
		continue
	if i % 3 == 0 or i % 5 == 0:
		continue
	ans = 'DENIED'
	break
print(ans)


n = int(input())
lst = [int(i) for i in input().split()]
for d in lst:
	if d % 2 == 0:
		if d % 3 != 0 and d % 5 != 0:
			print('DENIED')
			return
print('APPROVED')