Problem:
 Score: 200 points    Problem Statement  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 1 5
6 7 9 10 31      Sample Output 1 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.       Sample Input 2 3
28 27 24      Sample Output 2 DENIED  28 violates the condition, so the immigrant should not be allowed entry.

Solution (Python):



if False:
    N=int(input())
    A=[int(i) for i in input().split()]
    ans=[(i,a) for i,a in enumerate(A)]
    ans.sort(key=lambda x: x[1],reverse=True)
    for i in range(N): print(ans[i][0]+1)


if False:
    N,P=map(int,input().split())
    A=[int(i) for i in input().split()]
    flag=True 
    for a in A:
        if a%2==1:
            flag=False
            break
    if flag:
        if P==0:
            print(2**N)
        else:
            print(0)
    else:
        print(2**(N-1))


if False:
    print('Yes' if len(set(input().split()))==2 else 'No')

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

Solution (Python):
import sys

N=int(input())
A=list(map(int,input().split()))

for i in A:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue
        print("DENIED")
        sys.exit()
print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

if any([(i % 3 != 0) and (i % 5 != 0) for i in a if not i % 2]):
    print('DENIED')
else:
    print('APPROVED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a % 2 == 1:
        continue
    elif a % 3 == 0 or a % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()

print("APPROVED")

Solution (Python):
def approve(A: list) -> bool:
    is_even = lambda number: number % 2 is 0
    is_odd = lambda number: not is_even(number)
    is_dividable_by_3 = lambda number: number % 3 is 0
    is_dividable_by_5 = lambda number: number % 5 is 0
    is_dividable_by_3_or_5 = lambda number: is_dividable_by_3(number) or is_dividable_by_5(number)
    is_approved = lambda number: (
        is_odd(number) or
        (is_even(number) and is_dividable_by_3_or_5(number)))

    approved = all(map(is_approved, A))

    return approved


N = input()
A = list(map(int, input().split()))

answer = 'APPROVED' if approve(A) else 'DENIED'

print(answer)

Solution (Python):
def approve(A: list) -> bool:
    is_even = lambda number: number % 2 is 0
    is_odd = lambda number: not is_even(number)
    is_dividable_by_3 = lambda number: number % 3 is 0
    is_dividable_by_5 = lambda number: number % 5 is 0
    is_dividable_by_3_or_5 = lambda number: is_dividable_by_3(number) or is_dividable_by_5(number)
    is_approved = lambda number: (
        is_odd(number) or
        (is_even(number) and is_dividable_by_3_or_5(number)))

    approved = all([is_approved(Ai) for Ai in A])

    return approved


N = input()
A = list(map(int, input().split()))

answer = 'APPROVED' if approve(A) else 'DENIED'

print(answer)

Solution (Python):
N = input()
A = list(map(int, input().split()))

is_even = lambda number: number % 2 == 0
is_odd = lambda number: not is_even(number)
is_dividable_by_3 = lambda number: number % 3 == 0
is_dividable_by_5 = lambda number: number % 5 == 0
is_dividable_by_3_or_5 = lambda number: is_dividable_by_3(number) or is_dividable_by_5(number)
is_approved = lambda number: is_odd(number) or (is_even(number) and is_dividable_by_3_or_5(number))

answer = 'APPROVED' if all([is_approved(Ai) for Ai in A]) else 'DENIED'

print(answer)

Solution (Python):
N = int(input())
A = list(map(int, input().strip().split()))
a = True
for i in list(filter(lambda x: x % 2 == 0, A)):
    if i % 3 != 0 and i % 5 != 0:
        print("DENIED")
        a = False
        break

if a:
    print("APPROVED")

Solution (Python):
N = int(input())
An = list(map(int,input().split()))

for i in An:
    if i%2==0:
        if i%3 !=0 and i%5!=0:
            print('DENIED')
            exit()
else:
    print('APPROVED')

Solution (Python):
N = int(input())
lis = list(map(int,input().split()))
x = 0
for i in lis:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            x += 1
if x == 0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
lis = list(map(int,input().split()))
x = 0
for i in lis:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            x += 1
if x == 0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
_ = int(input())
A = list(map(int, input().split()))

if len(list(filter(lambda x: x%2==0 and (x%3!=0 and x%5!=0), A))):
    print('DENIED')
else:
    print('APPROVED')

Solution (Python):

import sys


N = int(input())
a = list(map(int, input().split()))

for i in a:
    if i % 2 == 0:
        if (i % 3 == 0) or (i % 5 == 0):
            continue
        else:
            print('DENIED')
            sys.exit()

print('APPROVED')

Solution (Python):
N = int(input())
X = [int(x) for x in input().split()]

Y = [x for x in X if x%2 == 0]

Z = [y for y in Y if y%3 != 0 and y%5 != 0]

if len(Z) == 0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
if all([i%2==1 for i in A]):
    print('APPROVED')
else:
    even = [i for i in A if i%2==0]
    even = [0 if i%3==0 or i%5==0 else 1 for i in even]
    if max(even)==1:
        print('DENIED')
    else:
        print('APPROVED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

index = 0

for a in A:
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      index += 1

if index > 0:
  print('DENIED')
else:
  print('APPROVED')

Solution (Python):
input()
print('DENIED'if any(True for x in map(int,input().split())if x%2==0 and x%3!=0 and x%5!=0)else 'APPROVED')

Solution (Python):
N = input()
A = list(map(int, input().split()))

for i in A:
    i = int(i)
    if i % 2 == 0:
        if i % 3 !=0 and i % 5 !=0:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
f=True
for i in a:
  if i%2==0:
    if i%3==0 or i%5==0:
      f=True
    else:
      f=False
      break
if f:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
import sys
a = input()
b = map(int, input().split())
list = []
for item in b:
    if item % 2 == 0:
        list.append(item)
for item in list:
    if not(item % 3 == 0) and not(item % 5 == 0):
        print("DENIED")
        sys.exit()
print("APPROVED")

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

Solution (Python):
import sys
input = sys.stdin.readline
def print_ans(N, ar):
    """Test Case
    >>> print_ans(5, [6, 7, 9, 10, 31])
    APPROVED
    >>> print_ans(3, [28, 27, 24])
    DENIED
    """
    flg = True
    for a in ar:
        if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
            flg = False
            break

    if flg:
        print("APPROVED")
    else:
        print("DENIED")



if __name__ == '__main__':
    N = int(input().rstrip())
    ar = list(map(int, input().rstrip().split()))
    print_ans(N, ar)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
count = 0
for i in A:
    if i % 2 == 0:
        count +=1
        if i % 5 == 0 or i % 3 == 0:
            count -=1
if count == 0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
even = 0
count = 0
for i in range(n):
    if l[i] % 2 == 0:
        even += 1
        if l[i] % 3 == 0 or l[i] % 5 == 0:
            count += 1
if count == even:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())

a = [0]*N
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
  if i == N-1:
    print('APPROVED')

Solution (Python):
n = int(input())
num = list(map(int, input().split()))

for i in range(n):
  if num[i]%2==0:
    if num[i]%3!=0 and num[i]%5!=0:
      print('DENIED')
      exit()
      
print('APPROVED')

Solution (Python):
n=int(input())
arr=[int(i) for i in input().split()]
def ans():
  for i in range(n):
    if arr[i]%2==0:
      if arr[i]%3!=0 and arr[i]%5!=0:
        return('DENIED')
  return('APPROVED')
print(ans())

Solution (Python):
n = int(input())

a_list = [int(s) for s in input().split()]
a_list = [a for a in a_list if a % 2 == 0]


approved_flag = True
for a in a_list:
    if a % 3 != 0 and a % 5 != 0:
        approved_flag = False
        break

ans = "APPROVED" if approved_flag else "DENIED"
print(ans)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))

check=1
for i in range(N):
    if A[i]%2==0:
        if A[i]%3==0 or A[i]%5==0:
            pass
        else:
            check=0
            break

if check==1:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
result = "APPROVED"

for a in A:
    if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
        result = "DENIED"
print(result)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

for a in A:
    if (a % 2 == 0) and ((a % 3 != 0) and (a % 5 != 0)):
        print('DENIED')
        exit()

print('APPROVED')

Solution (Python):
import sys
n = input()
list_a = list(map(int, input().split()))

for a in list_a:
  if a%2 == 0:
      if a%3 == 0:
        continue
      
      if a%5 == 0:
        continue

      print("DENIED")
      sys.exit()

print("APPROVED")

Solution (Python):
N  = int(input())
l = list(map(int, input().split()))

for i in l:
    if i % 2 == 0:
        if i % 3 !=0 and i % 5 != 0:
            print("DENIED")
            exit()

print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = True
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!=0 or (a[i]%3==0 or a[i]%5==0):
        continue
    else:
        ans = False
        exit
if ans:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
c = True
for i in range (N):
    if A[i]%2==1 or A[i]%3==0 or A[i]%5==0:
      c = True
    else:
      c = False
      break
      
if (c):
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
N=int(input())
A=list(map(int, input().split()))

for i in range(N):
    if A[i]%2==1:
        continue
    else:
        if A[i]%6!=0 and A[i]%10!=0:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
import sys


n = int(input())

a_list = list(map(int, input().split()))

for a in a_list:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            print('DENIED')
            sys.exit(0)

print('APPROVED')

Solution (Python):
n = int(input())
a_list = list(map(int, input().split()))


for i in a_list:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            print('DENIED')
            exit()

print('APPROVED')

Solution (Python):
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n=n0()
a=n1()

c=[min(x%3,x%5) if x%2==0 else 0 for x in a]
print("APPROVED" if sum(c)==0 else "DENIED")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

counter1 = 0
counter2 = 0
for i in range(N):
    if A[i] % 2 == 0:
        counter1 += 1
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            counter2 += 1
if counter1 == counter2:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N=input()
a=input().split()
list1=[]
for item in a :
  list1.append(int(item))
flag=True
for item in list1 :
  if item%2==0 :
    if not (item%3==0 or item%5==0) :
      flag=False
      break
  
if flag :
  print('APPROVED')
else :
  print('DENIED')

Solution (Python):
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")
            exit()

print("APPROVED")

Solution (Python):
N = int(input())
A = map(int, input().split())

ans = 0
for i in A:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            ans += 1

print("APPROVED" if ans == 0 else "DENIED")

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

Solution (Python):

n = int(input())

l = list(map(int, input().split()))

sum = 0

for i in range (0, n):
	if l[i]%2 == 0:
		if l[i]%3 != 0 and l[i]%5 != 0:
			sum+=1

if sum ==0:
	print('APPROVED')
else:
	print('DENIED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

for a in A:
  if a%2 == 0 and not (a%3 == 0 or a%5 == 0):
    print('DENIED')
    break
else:
  print('APPROVED')

Solution (Python):
N = input()
A = list(map(int, input().split()))

flg = True
for i in A:
    if i % 2==0:
        if i % 3!=0 and i % 5!=0:
            flg = False
            break
if flg:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
input()
print("APPROVED") if all(int(i) % 3 == 0 or int(i) % 5 == 0 for i in input().split() if int(i) % 2 == 0) else print("DENIED")

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

Solution (Python):
N = int(input())
lists = list(map(int, input().split()))

for i in lists:
    if i % 2 == 0:
        if i % 3 == 0:
            continue

        elif i % 5 == 0:
            continue

        else:
            print("DENIED")
            exit()

print("APPROVED")

Solution (Python):
n = int(input());

v = [int(i) for i in input().split()];

f = True;

for x in v:
    if x % 2 == 0:
        f = f and (x % 3 == 0 or x % 5 == 0);

if f == True:
    print('APPROVED');
else:
    print('DENIED');

Solution (Python):
n = int(input())
base = input().split()
num = []
for i in base:
    num.append(int(i))
x = 0
y = 0
for s in num:
    if s%2==0:
        x += 1
        if s%3==0 or s%5==0:
            y += 1
if x==y:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = map(int,(input().split()))

check = set([(Ai%3)*(Ai%5) for Ai in A if Ai%2 == 0])

if {0} == check or check == set():
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    a=LIST()
    flg=1
    for i in a:
        if i%2==0:
            if i%3==0 or i%5==0:
                pass
            else:
                flg=0
    if flg==1:
        print('APPROVED')
    else:
        print('DENIED')
    
if __name__ == '__main__':
    do()

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))

for num in nums:
  if num % 2 == 0:
    if num % 3 != 0 and num % 5 != 0:
      print("DENIED")
      exit()
else:
  print("APPROVED")

Solution (Python):



def main():
    n = int(input())
    syorui = list(map(int, input().split()))

    even_nums = list(filter(lambda x: x % 2 == 0, syorui))
    result_list = list(filter(lambda x: x % 3 == 0 or x % 5 == 0, even_nums))

    result = "DENIED"
    if len(even_nums) == len(result_list):
        result = "APPROVED"

    return result


if __name__ == '__main__':
    print(main())

Solution (Python):
n = int(input())
lst = list(map(int,input().split()))
print("APPROVED" if all(x%3 == 0 or x%5 == 0 for x in list(filter(lambda x: x%2 == 0, lst))) else "DENIED")

Solution (Python):
n = int(input())
x = list(map(int,input().split()))
for i in x:
    if(i%2==0 and (i%3!=0 and i%5!=0)):
        print("DENIED")
        break
else:
    print("APPROVED")

Solution (Python):
n = int(input())
x = list(map(int,input().split()))
for i in x:
    if(i%2==0 and (i%3!=0 and i%5!=0)):
        print("DENIED")
        break
else:
    print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
if all([i%3==0 or i%5==0 for i in a if i%2==0]):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
_, L = input(), list(map(int, input().split()))
L = [l for l in L if l % 2 == 0]
M = [l for l in L if (l % 3 == 0) or (l % 5 == 0)]
if len(L)==len(M):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
print('APPROVED' if all(map(lambda x:x % 3 == 0 or x % 5 == 0, filter(lambda x:x % 2 == 0, A))) else 'DENIED')

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
print("APPROVED" if all([i%2!=0 or i%3==0 or i%5==0 for i in A]) else "DENIED")

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

Solution (Python):
input();print(' ADPEPNRIOEVDE D'[all([i%2|(i%3<1)|(i%5<1)for i in map(int,input().split())])::2])

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
ans="APPROVED"

for i in range(N):
  if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
    ans="DENIED"

print(ans)

Solution (Python):
N = int(input())
array = [int(x) for x in input().split()]
fl=True
for i in array:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
        fl = False
if fl: print('APPROVED')
else:print('DENIED')

Solution (Python):
a= int(input())
b_list = input().split()
for i in range(a):
    b = int(b_list[i])
    if b%2 == 0:
        if b % 3 == 0 or b%5 == 0:
            d =0
        else:
            print('DENIED')
            break
    if (a-1) == i:
        print('APPROVED')

Solution (Python):

N=int(input())
A=list(map(int,input().split()))
ans1=0
ans2=0
for i in range(N):
    if A[i]%2==0:
        ans1=1
        if A[i]%3!=0 and A[i]%5!=0:
            ans2=1
if ans2!=1:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
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')
            exit()
print('APPROVED')

Solution (Python):










"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
  
def main():
  n = int(input())
  A = list(map(int,input().split()))
  for i in range(n):
    if A[i] % 2 == 0:
      if A[i] % 3 == 0 or A[i] % 5 == 0:
        pass
      else:
        print('DENIED')
        exit()
  print('APPROVED')
  
if __name__ == '__main__':
  main()

Solution (Python):
def check(arr):
    for i in arr:
        if(i % 2 ==0):
            if(i % 3!=0 and i % 5!=0):
                return "DENIED"
    return "APPROVED"

n=int(input())
arr=list(map(int,input().strip().split()))[:n]
k=check(arr)
print(k)

Solution (Python):
N = input().rstrip()
num = [int(i) for i in input().rstrip().split(' ')]

ret = 'APPROVED'
for i in num:
    if i % 2 == 0:
        if not i % 3 == 0 and not i % 5 == 0:
            ret = 'DENIED'
            break

print(ret)

Solution (Python):
S = int(input())
li = list(map(int,input().split()))
a = 0
for i in range(S):
    if li[i] % 2 == 0 and li[i] % 3 != 0 and li[i] % 5 != 0:
        print("DENIED")
        a += 1
        break
if a == 0:
    print("APPROVED")

Solution (Python):


n = int(input())
a = list(map(int, input().split()))
flag = 0

for i in range(n):
    if a[i] % 2 == 0:
        if ( a[i] % 3 != 0 )and( a[i] % 5 != 0 ):
            flag = 1

if flag:
    print('DENIED')
else:
    print('APPROVED')

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

bl = True
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            bl = False

print('APPROVED' if bl else 'DENIED')

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))  
B = list()
judge = 1
for a in A:
    if a%2 == 0:
        B.append(a)

for b in B:
    if b%3==0 or b%5==0:
        continue
    else:
        judge = -1

if judge == 1:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = input()
a = list(map(int, input().split()))

isApproved = True
for i in a:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			isApproved = False
			break

result = "APPROVED" if isApproved else "DENIED"

print(result)

Solution (Python):
n = int(input())
A = [int(x) for x in input().split()]

ans = 'DENIED'
judge = []
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            judge.append(True)
        else:
            judge.append(False)
            
if all(judge):
    ans = 'APPROVED'
    print(ans)
else:
    print(ans)

Solution (Python):
n = int(input())
a_list = list(map(int, input().split()))
flag = "ok"
for i in a_list:
  
  if i%2 == 0: 
    if i%3 != 0 and i%5 != 0:
      flag = "ng"
if flag == "ok":
  print("APPROVED") 
else:
  print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
res = True
for v in A:
    if v % 2 == 0 and v % 3 != 0 and v % 5 != 0:
        res = False
print("APPROVED" if res else "DENIED")

Solution (Python):
n = int(input())
a = map(int, input().split())

result = True
for i in a:
    if i % 2 == 0 and i % 3 != 0 and i % 5 != 0:
        result = False
        break

print('APPROVED' if result else 'DENIED')

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

Solution (Python):
n = int(input())
al = list(map(int, input().split()))

for a in al:
    if a%2==0:
        if a%3==0 or a%5==0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
even = []

for i in a:
    if i % 2 == 0:
        even.append(i)

ele = 0

for x in even:
    if  not (x % 3 == 0 or x % 5 == 0):
        print("DENIED")
        break
    else:
        ele += 1

if ele == len(even):
    print("APPROVED")

Solution (Python):
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")
      exit()
print("APPROVED")

Solution (Python):
*A,=map(int,open(0).read().split());a='APPROVED';i=1
while i<len(A):
    if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
        a='DENIED'
    i+=1
print(a)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

for digit in a:
    if digit % 2 == 0:
        if digit % 3 != 0 and digit % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
check1 = 0
check2 = 0
for i in range(N):
    if A[i]%2 == 0:
        check1+=1
for i in range(N):
    if A[i]%2 == 0:
        if A[i]%3 == 0 or A[i]%5 == 0 :
            check2+=1
        else:
            check2+=0
    else:
        check2+=0
if check1 == check2:
    print("APPROVED")
elif check1 != check2:
    print("DENIED")

Solution (Python):
import bisect
import heapq
import sys
import queue


input = sys.stdin.readline
sys.setrecursionlimit(100000)


class V:
    def __init__(self, f):
        self.f = f
        self.v = None

    def __str__(self):
        return str(self.v)

    def ud(self, n):
        if self.v is None:
            self.v = n
        else:
            self.v = self.f(self.v, n)

    def get(self):
        return self.v


def read_values():
    return map(int, input().split())


def read_list():
    return list(read_values())


def main():
    N = int(input())
    A = read_list()
    print(
        "APPROVED"
        if all(map(lambda a: a % 2 == 1 or (a % 3 == 0 or a % 5 == 0), A))
        else "DENIED"
    )


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
l=input().split()
l=[int(i) for i in l]
a=0
for i in l:
    if i%2==0:
        if i%3==0 or i%5==0:
            a+=1
    else:
        a+=1
if a==N:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
input()
lst=list(map(int,input().split()))
tf=0
for i in lst:
  tf+=(1-i%2)*(i%3)*(i%5)
if tf:
  print('DENIED')
else:
  print('APPROVED')

Solution (Python):
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')
            exit()
print('APPROVED')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
for b in a:
    if b%2 == 0:
        if b%3 == 0 or b%5 == 0:
            continue
        else:
            print('DENIED')
            exit()
else:
    print('APPROVED')

Solution (Python):
n = int(input())
a = [int(i) for i in input().split() if int(i) % 2 == 0]
for i in a:
    if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
N = int(input())
A = [0]*N
check = 1
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:
            check += 1
        else:
            check = 0
            break
if check >=1:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
text = 0
for j in range(n):
    if a[j] % 2 == 0:
        if a[j] % 3 != 0 and a[j] % 5 != 0:
            text = 1
            print("DENIED")
            break
if text == 0:
    print("APPROVED")

Solution (Python):
N=int(input())
ls=[int(s) for s in input().split()]
for e in ls:
  if e%2==0 and (e%3)*(e%5)!=0:
    print('DENIED')
    break
else:
  print('APPROVED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

ans = 'APPROVED'

for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 !=0:
            ans = 'DENIED'
            break

print(ans)

Solution (Python):
def resolve():
    N = int(input())
    arr = list(map(int, input().split()))
    f = True
    for num in arr:
        if not num % 2 and not (num % 3 == 0 or num % 5 == 0):
            print('DENIED')
            f = False
            break
    if f:
        print('APPROVED')


resolve()

Solution (Python):
n = int(input())
a = map(int, input().split())
odd = [i for i in a if i%2==0]
if len(odd) == len([i for i in odd if i%3==0 or i%5==0]):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int((input()))
a = list(map(int, input().split()))

f = True
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            f = True
        else:
            f = False
            break
if f:
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
n = int(input())
a = map(int, input().split())
t1 = []
t2 = []
for i in a:
    if i % 2 == 0:
        t1.append(i)
        if i % 3 == 0 or i % 5 == 0:
            t2.append(i)
if t1 == t2:
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
def check(l):
    for i in l:
        if i%2==0:
            if i%3 and i%5:
                return False
    return True
def solve():
    n = int(input())
    a = tuple(map(int,input().split()))
    if check(a):
        print('APPROVED')
    else:
        print('DENIED')
if __name__ == "__main__":
    solve()

Solution (Python):

n = int(input())
x = list(map(int, input().split()))

isOK = "APPROVED"

for n in x:
    if (n % 2 == 0):
        if (n % 3 != 0 and n % 5 != 0):
            isOK = "DENIED"

print(isOK)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = []
for i in range(N):
    if A[i] % 2 == 0:
        B.append(A[i])
a = 0
for j in range(len(B)):
    if B[j] % 3 == 0:
        a = a+0
    elif B[j] % 5 == 0:
        a = a+0
    else:
        a = a+1

if a == 0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n=int(input())
h=list(map(int,input().split()))
cnt1=0
cnt2=0
for i in range(n):
  if h[i]%2==0:
    cnt1+=1
    if h[i]%3==0 or h[i]%5==0:
      cnt1-=1
    else:
      print('DENIED')
      break
else:
  print('APPROVED')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))

flag = True
for ai in a:
    if ai % 2 == 0:
        flag &= (ai % 3 == 0 or ai % 5 == 0)

print("APPROVED" if flag else "DENIED")

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

Solution (Python):
input()

vals = input().split(" ")
vals = map(int, vals)

bol = True

for val in vals :
	if val % 2 == 0 :
	  if not (val % 3 == 0 or val % 5 == 0) :
	    bol = False

if bol :
  print("APPROVED")
else : 
  print("DENIED")

Solution (Python):
import sys

n=int(input())

a=list(map(int,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")
      sys.exit()

print("APPROVED")