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):
N = int(input())
A = [int(a) for a in input().split()]

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

if flag:
    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 and a[i]%5!=0:
      print('DENIED')
      sys.exit()
print('APPROVED')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
i = 0
while i < n:
    if a[i] % 2 == 0 and (a[i] % 3 != 0 and a[i] % 5 != 0):
        print("DENIED")
        break
    else:
        i += 1
if i == n:
    print("APPROVED")

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

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

if buf == True :
    print('APPROVED')
else :
    print('DENIED')

Solution (Python):
a, *a_n = map(int, open(0).read().split())


flag = 1
for num in a_n:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flag = 0
            break
        
if flag == 1:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
from functools import reduce
input()
a = map(int, input().split())
def test(n):
    if n % 2 == 1:
        return True
    else:
        return n % 3 == 0 or n % 5 == 0
print('APPROVED' if reduce(lambda x, y:x and y, map(test, a)) else 'DENIED')

Solution (Python):
def jud_oe(x):
    if x%2 == 0:
        if (x%3 == 0) or (x%5 ==0):
            return 1
        else:
            return 0
    else:
        return 1


n = int(input())
a = list(map(int,input().split()))
b = list(map(jud_oe,a))
judge = 0 in b

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

Solution (Python):



import pdb
import sys
F = sys.stdin

N = int(F.readline().rstrip())
A = list(map(int,F.readline().rstrip().split()))

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

print('APPROVED')

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

nums = [n for n in nums if n%2==0]
f = True

for i in nums:
  if i%3!=0:
    if i%5!=0:
      print("DENIED")
      f = False
      break
if f:
  print("APPROVED")

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

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

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

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

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

Solution (Python):
import sys
from collections import deque

n=int(input())
alst=[int(x) for x in input().split(" ")]

for a in alst:
    if a%2==0 and a%3>0 and a%5>0:
        print("DENIED")
        break
else:
    print("APPROVED")

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

ev = 0
s = 0
for i in range(n):
  if a[i]%2 == 0:
    ev += 1
    if a[i]%3 == 0 or a[i]%5 == 0:
      s += 1

if ev == s:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(input())
    A = tuple(map(int, input().split()))

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

if __name__ == '__main__':
    main()

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 or a[i] % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")

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

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

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:
            continue
        elif a[i] % 5== 0:
            continue
        else :
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
usrCount = int(input())
usrNumbers = input().split()
usrList = []

guusuList = []

okCount = 0

for n in range(len(usrNumbers)):
    usrList.append(int(usrNumbers[n]))

for m in range(len(usrList)):
    if usrList[m] % 2 == 0:
        guusuList.append(usrList[m])

for l in range(len(guusuList)):
    if guusuList[l] % 3 == 0 or guusuList[l] % 5 == 0:
        okCount = okCount + 1

if okCount >= len(guusuList):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n=int(input())
arr=input().split(" ")
flag=True
for i in arr:
    i=int(i)
    if i%2==0:
        if i%3!=0 and i %5!=0:
            print("DENIED")
            flag=False
            break
if flag:
    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] % 5 != 0 and A[i] % 3 != 0:
			flag = 1
			break

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

Solution (Python):
target = input('')
list_score = list(map(int, input().split()))
a = []
for i in range(len(list_score)):
    if list_score[i] % 2 == 0:
        a.append(list_score[i]/2)

ans = "APPROVED"

for i in range(len(a)):
    if a[i] % 3 != 0:
        if a[i] % 5!= 0:
            ans = "DENIED"

print(ans)

Solution (Python):
n = int(input())
a = [x for x in map(int, input().split()) if x % 2 == 0]

ans = 'APPROVED'
for x in a:
    if not (x%3==0 or x%5==0):
        ans = 'DENIED'
print(ans)

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

for i in range(n):
    if N[i]%2 == 0:
        if N[i]%3 == 0 or N[i]%5 == 0:
            pass
        else:
            print('DENIED')
            break
else:
    print('APPROVED')

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

nn = [ a for a in n if a%2==1 or a%3==0 or a%5==0]

if len(n) == len(nn):
    print("APPROVED")
else:
    print("DENIED")

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




Flag = True
for i in range(N):
    if A_list[i] % 2 == 0:
        if A_list[i] % 3 == 0 or A_list[i] % 5 == 0:
            continue
        else:
            Flag = False
            break

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

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

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

approve = True
for i in a:
    if i % 2 != 0:
        continue
    if i % 3 != 0 and i % 5 != 0:
        approve = False
        break
print(['DENIED', 'APPROVED'][approve])

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

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

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

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

Solution (Python):
N = input()
A = input().split(' ')
N = int(N)
ans = 'APPROVED'
for ii in range(N):
  Ai = A[ii]
  Ai = int(Ai)
  
  if Ai%2 == 0:
    if Ai%3 != 0 and Ai%5 !=0:
      ans = 'DENIED'


print(ans)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i%2==0:
    FLAG=False
    if i%3==0:
      FLAG=True
    if i%5==0:
      FLAG=True
    if not FLAG:
      print("DENIED")
      exit()
print("APPROVED")

Solution (Python):


from math import ceil,floor









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

ans = "APPROVED"

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

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = ()
for i in range(N):
    if A[i]%2 == 0:
        B = B + (A[i],)

for i in range(len(B)):
    if (B[i]%3 != 0) and (B[i]%5 != 0):
        print("DENIED")
        exit()

print("APPROVED")

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

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

s = [c for c in b if c%2 == 0]

for p in s:
  if (p % 3 != 0) & (p % 5 != 0):
    print("DENIED")
    break
else:
  print("APPROVED")

Solution (Python):

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

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

for i in range(n):
    num = a[i]

    if num % 2 == 1:
        continue
    else:
        if num % 3 == 0 or num % 5 == 0:
            continue
        else:
            print('DENIED')
            exit()

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
      break
if flag==1:
  print("DENIED")
else:
  print("APPROVED")

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

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

Solution (Python):

"""
Created on Sun Feb 16 20:59:51 2020

@author: H_Hoshigi
"""

N = int(input())
A_list = list(map(int, input().split()))
answer = "APPROVED"

for i in A_list:
    if i%2==1:
        pass
    else:
        if i%3==0 or i%5==0:
            pass
        else:
            answer = "DENIED"
            break
print(answer)

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

a = [int(x) for x in input().split()]

flag = 0

for x in a:
  if x % 2 == 0:
    if x % 3 == 0 or x % 5 == 0:
      continue
    else:
      flag = 1
      break

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
ans = "APPROVED"
for a_i in a:
    if a_i % 2 != 0: continue
    else:
        if a_i % 3 != 0 and a_i % 5 != 0:
            ans = "DENIED"
            break
print(ans)

Solution (Python):
N,*A = map(int,open(0).read().split())
F = True
for i in range(N):
  if A[i]%2 == 0:
    if not ((A[i]%3 == 0) or (A[i]%5 == 0)):
      F = False
print("APPROVED" if F else "DENIED")

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
p=1
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            p=0

if p==0:
    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 or A[i] % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()
    else:
        pass

print("APPROVED")

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
ans = 'APPROVED'
for i in l:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ans = 'DENIED'

print(ans)

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

Solution (Python):
num = int(input())
lists = list(map(int,input().split()))
result = "APPROVED"
for i in range(num):
  if lists[i] % 2 == 0:
    if not ((lists[i] % 3 == 0) or (lists[i] % 5 == 0)):
      result = "DENIED"
print(result)

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

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

judge = True
for a in a_list:
    if a % 2 ==0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            judge = False
            break

if judge is True:
    print('APPROVED')
else:
    print('DENIED')

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

Solution (Python):
n = input()
X = set(map(int, input().split()))
E = [x for x in X if x % 2 == 0]
EE = [e for e in E if (e % 3 == 0 or e % 5 == 0)]
if len(E) == len(EE):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = [int(a) for a in input().split()]

answer = 'APPROVED'

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

Solution (Python):
import sys


def input():
    return sys.stdin.readline()[:-1]


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

A_ = [i for i in A if i % 2 == 0 ]
B_ = [i for i in A_ if i % 3 == 0 or i % 5 == 0]


if len(A_) == len(B_):
	print("APPROVED")
else:
	print("DENIED")

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

a = list(map(int, input().split()))
count = 0
for i in range(n):
    if (a[i]%2) or (a[i]%3==0) or (a[i]%5==0):
        count += 1

if count == n:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
N = int(input())
A = [int(zz) for zz in input().split()]
li = []
li2 = []
n = 0
for i in A:
    if i%2 == 0:
        li.append(i%3)
        li2.append(i%5)
        n += 1

for i in range(n):
    if li[i]*li2[i] != 0:
        print('DENIED')
        exit()
print('APPROVED')

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

B = list(filter(lambda x: x % 2 == 0,A))
C = list(map(lambda x: (x % 5 == 0)or(x % 3 == 0),B))

print(["APPROVED","DENIED"][False in C])

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

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

cnt=0
for i in a:
    if(i%2==0):
        if(i%3==0 or i%5==0):
            cnt=cnt+0
        else:
            cnt=+1
if(cnt>0):
    print('DENIED')
else:
    print('APPROVED')

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

res = 'APPROVED'
for i in range(len(A)):
  if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0:
    res = 'DENIED'

print(res)

Solution (Python):
Y,N = "APPROVED","DENIED"

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

f = 1
for i in A:
    if i%2==0 and f==1:
        if i%3==0 or i%5==0:
            pass
        else:
            f=0

print(Y) if f else print(N)

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

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

print(ans)

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

res = [0]
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            res.append(0)
        else:
            res.append(1)

if sum(res) > 0:
    print("DENIED")    
else:
    print("APPROVED")

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

if(not d):
    print('APPROVED')

Solution (Python):
N = int(input())
List=list(map(int,input().split()))
ans = 0
a = 1

for i in List:
  if i%2 == 0:
    if i%3 == 0 or i%5 == 0:
      a=1      
    else:
      ans = 1
      
if ans == 1:
  print("DENIED")
else:
  print("APPROVED")

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

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

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

A_list_choose = [j for j in A_list if j % 2 == 0]

flag = 0

for i in range(len(A_list_choose)):
    tmp = A_list_choose[i]
    if tmp%3==0 or tmp%5==0:
        continue
    else:
        flag = 1
        break

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

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

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

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 or A[i]%5==0:
      flag=0
    else:
      flag=1
      break
      
if flag==0:
  print("APPROVED")
else:
  print("DENIED")

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

L=[]
for n in N:
    if n%2==0:
        L.append(n)
ans='APPROVED'
for l in L:
    if l%3==0 or l%5==0:
        ans='APPROVED'
    else:
        ans='DENIED'
        break


print(ans)

Solution (Python):
def main():
    N = int(input())
    a_list = list(map(int, input().split(' ')))
    answer = 'APPROVED'
    for a in a_list:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                answer = 'DENIED'
                break
    print(answer)


if __name__ == '__main__':
    main()

Solution (Python):
import sys
N=int(input())
A=[int(_) for _ in input().split()]

for i in range(N):
  if A[i]%2==0:
    if (A[i]%6 ==0) or (A[i]%10==0):
      continue
    else:
      print('DENIED')
      sys.exit()
print('APPROVED')

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

flag = 0
for aa in a:
    if aa % 2 == 0 and aa % 3 != 0 and aa % 5 != 0:
        flag = 1
        break

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

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

permission = 'APPROVED'

for i in num_list:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            permission = 'DENIED'
            break
        
print(permission)

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

Solution (Python):
input()
A=list(map(int,input().split()))
for a in A:
    if a%2<1 and a%3>0 and a%5>0:
        print('DENIED')
        exit()
print('APPROVED')

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

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

Solution (Python):






import math
import statistics
import numpy as np
import queue

n = int(input())
a = list(int(i) for i in input().split())

cnt, subcnt = 0, 0
for i in a:
	if i % 2 == 0:
		subcnt += 1
		if i % 3 == 0 or i % 5 == 0:
			cnt += 1

if subcnt == cnt:
	print('APPROVED')
else:
	print('DENIED')

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

even_count = 0
ok_count = 0
for ai in a:
  if ai % 2 == 0:
    even_count += 1
    if ai % 3 == 0:
      ok_count += 1
      continue
      
    if ai % 5 == 0:
      ok_count += 1
      continue

if even_count == ok_count:
  print('APPROVED')
else:
  print('DENIED')

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
flag = 1
for i in range(n):
    if a[i]%2 ==0:
        if not((a[i]%3==0)or(a[i]%5==0)):
            flag=0

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

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

print('APPROVED')

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = "APPROVED"
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 6 != 0 and a[i] % 10 != 0:
            ans = "DENIED"
            break
print(ans)

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

d = 'APPROVED'
for i in a:
  if i % 2 == 0:
    if i % 3 == 0:
      continue
    elif i % 5 == 0:
      continue
    else:
      d = 'DENIED'
      break

print(d)

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

for i in a:
    if i % 2 == 0:
        if i % 6 == 0 or i % 10 == 0:
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):
def check(n, da):
    for i in da:
        if i%2 == 0:
            if not(i%3 == 0 or i%5 == 0):
                return False
    return True


n = int(input())


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

if check(n, da):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
def main():
    N=int(input())
    a=[int(x) for x 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")


if __name__ == '__main__':
    main()

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

even_list = []
for ai in a:
  if ai % 2 == 0:
    even_list.append(ai)

for e in even_list:    
  if e % 3 != 0 and e % 5 != 0:
    print('DENIED')
    exit()
print('APPROVED')

Solution (Python):
input()
passport = input().split()
approveflag=True
for strx in passport:
    x = int(strx)
    if x%2==0 and not (x%3==0 or x%5==0):
        approveflag = False

if approveflag == True:
    print('APPROVED')
else:
    print('DENIED')

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

Process = True
i = 0
while i < n:
    if a[i] % 2 == 0:
        if a[i] % 3 != 0 and a[i] % 5 != 0:
            Process = False
    i += 1

if Process:
    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")
      break
  else:
    pass
else:
  print("APPROVED")

Solution (Python):
import sys
N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a%2 == 0:
        if not (a%3 == 0 or a%5==0):
            print("DENIED")
            sys.exit()
print("APPROVED")

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

ans = "APPROVED"

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

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

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

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

ea = [i for i in a if i%2==0]

ea35 = [i for i in ea if i%3==0 or i%5==0]

if len(ea35)==len(ea):print('APPROVED')
else:print('DENIED')

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

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

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

Solution (Python):





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

    OK = True

    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                OK=False
    if OK:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()

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

Solution (Python):
n=int(input())
a=list(map(int, input().split()))
ng = False
for num in a:
  if num % 2 == 0:
    if num % 3 == 0 or num % 5 == 0:
      continue
    else:
      ng = True
      break

if not ng:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
_=int(input())
a= list(map(int,input().split()))
pa = True
for c in a:
    if c%2==0:
        if c%3==0 or c%5==0:pass
        else:pa=False
if pa:print('APPROVED')
else:print('DENIED')

Solution (Python):
i=int(input())
j=list(map(int,input().split()))
f=True
for k in j:
  if 2*(k//2)==k:
    if 3*(k//3)!=k:
      if 5*(k//5)!=k:
        f=False
        break
if f:
  print("APPROVED")
else:
  print("DENIED")

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

Solution (Python):
import numpy as np

n = int(input())

a = np.asarray(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):
input()
l=map(int,input().split())

noflag=False
for i in l:
    if i%2==0 and not(i%3==0 or i%5==0):
        noflag=True
if noflag:
    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()))
flag = 1
for i in range(N):
    a = A[i]
    if a%2==1 or (a%3==0 or a%5==0):
        continue
    else:
        flag = 0
        break
if flag==1:
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
n=int(input())
x=list(map(int,input().split()))
check=0
for y in x:
    if y%2==0:
        if y%3==0 or y%5==0:
            check=0
        else:
            check=1
            break

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

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

Solution (Python):
N = input()
a = input().split()
f = True
for i in a:
    numi = int(i)
    if numi%2 == 0:
        if(numi%3 != 0) and (numi%5 != 0):
            f = False
            break
        
if f:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = input()
nums = input().split()
num_list = [int(i) for i in nums]

mes = "APPROVED"
for num in num_list:
  if num % 2 ==0:
    if num % 3 == 0 or num % 5 == 0:
      pass
    else:
      mes = "DENIED"
print(mes)

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 or a%5 == 0:
            continue
        else:
            ans = "DENIED"
    else:
        pass
print(ans)

Solution (Python):
def resolve():
    n = int(input())
    a = list(map(int,input().split()))
    t = True
    for i in a:
        if i % 2 == 0 and (not (i % 3 == 0 or i % 5 == 0)):
            t = False
    if t:
        print("APPROVED")
    else:
        print("DENIED")
resolve()

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

D1 = 3
D2 = 5

ans = "APPROVED"

for A in A_list:
    if A%2 == 0:
        if (A%D1 != 0) & (A%D2 != 0):
            ans = "DENIED"
            break

print(ans)

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:
            if a[i]%5 != 0:
                print("DENIED")
                exit()
                
print("APPROVED")

Solution (Python):
N = int(input())
An = list(map(int, input().split()))
targ = [(a % 2 !=1) and (a % 3 != 0) and (a % 5 != 0)  for a in An]
key = "APPROVED" if sum(targ) == 0 else "DENIED"
print(key)

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")