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):
import sys
sys.setrecursionlimit(10**7) 
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right

from collections import deque


from collections import Counter

from itertools import accumulate

from heapq import heapify,heappop,heappush


from functools import lru_cache


def input(): return sys.stdin.readline()[:-1]
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)]) for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():
    mod = 1000000007
    

    N = int(input())
    
    A = tuple(map(int, input().split())) 
    
    
    flag=1
    for a in A:
        if a%2==1 or a%3==0 or a%5==0:
            pass
        else:
            flag=0
            break
    if flag:print('APPROVED')
    else: print('DENIED')





if __name__ == "__main__":
    main()

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=[i for i in a if i%2==0]
c=[k for k in a if k%6==0 or k%10==0]
if len(b)==len(c):
     print('APPROVED')
else:
     print('DENIED')

Solution (Python):
N = int(input())
num_iter = map(int, input().split())
flg = True
for i in num_iter:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            flg = False
if flg:
    print('APPROVED')
else:
    print('DENIED')

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

str = "APPROVED"

for i in range(n):
    if num[i] % 2 == 0:
        if num[i] % 6 != 0 and num[i] % 10 != 0:
            str = "DENIED"
            break

print(str)

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

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

flag =0
counter =0
for i in A:
    counter +=1
    if (i %2 ==1) or ((i%3)==0 or (i%5) == 0):
        pass
    else:
        flag =1

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

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

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

ok = True
for i in range(n):
  x = a[i]
  if x % 2 == 0:
    if x % 3 == 0 or x % 5 == 0:
      continue
    else:
      ok = False

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

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

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

Solution (Python):
N=int(input())
a=list(map(int,input().split()))
arr=[]
for A in a:
    if A%2==0:
        arr.append(A)
    else:
        pass

for n in arr:
    if n%3==0 or n%5==0:
        pass
    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]%3==0:
      pass
    elif A[i]%5==0:
      pass
    else:
      ans='DENIED'
      break
print(ans)

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

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

flg = 0
for i in A:
    if i % 2 == 0 and (i % 3 == 0 or i % 5 == 0) and flg != 2:
        flg = 1
    elif i % 2 == 0:
        flg = 2
      
if flg == 0 or flg == 1:
    print('APPROVED')  
else:
    print('DENIED')

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

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

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

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

    
if __name__ == "__main__":
    main()

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

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

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

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

for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      is_ok = False
      break

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

Solution (Python):

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

flg = True

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            flg = False
if flg:
    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:
            pass
        else:
            flag = 1
if flag == 1:
    print('DENIED')
else:
    print('APPROVED')

Solution (Python):
N = int(input())
S = list(map(int, input().split()))
flag = 0

for i in range(N):
    if S[i] % 2 == 0:
        if S[i] % 3 != 0 and S[i] % 5 != 0:
            flag += 1
            break

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

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

for i in range(len(A)):
  if A[i] %2 == 0:
    if A[i]%3 != 0 and A[i]%5 != 0:
      print("DENIED")
      exit()
    else:
      pass
  else:
    pass
  
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 and i % 5 != 0:
            print('DENIED')
            sys.exit()
print('APPROVED')

Solution (Python):
yes = "APPROVED"
no = "DENIED"

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

ans = yes if all([e % 2 == 1 or e % 3 == 0 or e % 5 == 0 for e in A]) else no
print(ans)

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

if __name__ == "__main__":
    main()

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

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

    
print(ret_val)

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

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

print('APPROVED')

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    n = int(input())
    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):
                print('DENIED')
                return
    print('APPROVED')


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
flag=False
for i in range(N):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
      flag=True
if flag==True:
  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 and i%5!=0:
      print("DENIED")
      sys.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 not ((a[i] % 3 == 0) | (a[i] % 5 == 0)):
            print('DENIED')
            break
else:
    print('APPROVED')

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

cnt = 0
for i in tmp:
    if i % 3 == 0 or i % 5 == 0:
        cnt += 1

if cnt == len(tmp):
    print('APPROVED')
else:
    print('DENIED')

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

for j in B:
    if j % 3 !=0 and j % 5 != 0:
        print("DENIED")
        exit()
print("APPROVED")

Solution (Python):
def abc155_b():
    N = int(input())
    A = list(map(int, input().split()))
    result = 'APPROVED'

    evens = [i for i in A if i % 2 == 0]
    for i in evens:
        if (i % 3 != 0) and (i % 5 != 0):
            result = 'DENIED'

    print(result)



if __name__ == "__main__":
    abc155_b()

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

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

print(ans)

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

ans = "APPROVED"
for ai in a:
    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(' ')))
ok = True
for a in A:
    if(a % 2 == 0):
        if(a % 3 != 0 and a % 5 != 0):
            ok = False

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

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

for a in range(N):
    if A[a]%2==0:
        if (not A[a]%3==0) and (not A[a]%5==0):
            print("DENIED")
            break
        
else:
    print("APPROVED")

Solution (Python):
n=int(input())
alis=list(map(int,input().split()))
for i in range(n):
  
  if alis[i]%2==0:
    if alis[i]%3!=0 and alis[i]%5!=0:
      print('DENIED')
      exit()

print('APPROVED')

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

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

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

for i in range(N):
    if S[i]%2==0:
        if S[i]%3!=0 and S[i]%5!=0:
            print("DENIED")
            
            exit()
print("APPROVED")

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

Solution (Python):

n, *a = map(int, open(0).read().split())
ans = 1
for i in a:
    if i % 2 == 0:
        if not(i % 3 == 0 or i % 5 == 0):
            ans = 0
if ans == 1:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
def actual(n, A):
    even_numbers = [x for x in A if x % 2 == 0]

    immigration_status_list = [(x % 3 == 0) or (x % 5 == 0) for x in even_numbers]

    if all(immigration_status_list):
        return 'APPROVED'

    return 'DENIED'


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

print(actual(n, A))

Solution (Python):
input()
a = 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):
def main() :
    input()
    a = map(int, input().split())
    for i in a :
        if i%2==0 and i%3 != 0 and i%5 != 0 :
            print("DENIED")
            return
            
        
    print("APPROVED")
    

if __name__ == '__main__':
    import sys;
    try:
        main(sys.argv)
    except TypeError:
        main()

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

Solution (Python):
n=int(input())
a=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())
a = list(map(int,input().split()))
ans = 1
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            pass
        else:
            ans = 0
            break
if ans == 1:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))
l = [e for e in arr if e % 2 == 0]
ans = ''
for e in l:
  if e % 3 == 0 or e % 5 == 0:
    next
  else:
    ans = 'DENIED'
if ans == '':
  ans = 'APPROVED'
print(ans)

Solution (Python):
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    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):
                print('DENIED')
                exit()
    else:
        print('APPROVED')


if __name__ == '__main__':
    solve()

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

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

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

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

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

    print("APPROVED")


if __name__ == "__main__":
    main()

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

    even = []

    for e in A:
        if e % 2 == 0:
            even.append(e)


    for e in even:
        if e % 3 != 0 and e % 5 != 0:
            print("DENIED")
            exit(0)

    print("APPROVED")


if __name__ == "__main__":
    main()

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

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

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

even = [i for i in A if i % 2 == 0]

for num in even:
    if num % 3 != 0 and num % 5 != 0:
        print("DENIED")
        exit()

print("APPROVED")

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

even_num=[]
for i in range(n):
  if a[i]%2==0:
    even_num.append(a[i])

flag = True
for j in range(len(even_num)):
  if even_num[j]%3==0 or even_num[j]%5==0:
    flag = True
  else:
    flag = False
    break

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

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

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

print('APPROVED')

Solution (Python):
lines = []
for i in range(2):
  inp = input()
  lines.append(inp)
searchList = []  
for i in range(int(lines[0])):
  split = lines[1].split()
  if int(split[i]) % 2 == 0:
    searchList.append(int(split[i]))
out = "APPROVED"
for s in searchList:
  if s % 3 != 0 and s % 5 != 0:
    out = "DENIED"
    print(out)
    break
if out == "APPROVED":
    print(out)

Solution (Python):
import sys
import decimal 

def input():
    return sys.stdin.readline().strip()

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

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

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

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

Solution (Python):
def resolve():
    N = int(input())
    add = list(map(int, input().split()))
    ans = []
    count = 0
    for i in add:
        if i%2 == 0:
            ans.append(i)
    for j in ans:
        if j%3 == 0 or j%5 == 0:
            count += 1
    print("DENIED" if count != len(ans) else "APPROVED")
resolve()

Solution (Python):
n = int(input())
apple = list(map(int, input().split()))
orange = []
for i in apple:
    if i%2 == 0:
        orange.append(i)
    else:
        pass
cnt = 0
for i in orange:
    if i%3==0 or i%5==0:
        cnt += 1
    else:
        pass
print("DENIED" if cnt!=len(orange) else "APPROVED")

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

x = 0
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            x += 0
        else:
            x += 1
if x == 0:
    print('APPROVED')
else:
    print('DENIED')

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

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

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

print("APPROVED")

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

status = 'APPROVED'
for i in range(n):
    if int(nums[i]) % 2 == 0:
        if int(nums[i]) % 3 != 0 and int(nums[i]) % 5 != 0:
            status = 'DENIED'
            break
print(status)

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

Solution (Python):
input()
ns = list(filter(lambda x: int(x)%2==0 and not(int(x)%3==0 or int(x)%5==0), input().split()))
print("APPROVED" if len(ns)==0 else "DENIED")

Solution (Python):
import sys
n=int(input())
List=list(map(int,input().split()))
for i in range(len(List)):
    if List[i]%2==0:
        if List[i]%3!=0 and List[i]%5!=0:
            print("DENIED")
            sys.exit()
print("APPROVED")

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

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

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

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

A = [i for i in A 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())
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")
      break
else:
  print("APPROVED")

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

Solution (Python):
n = int(input())
num_list = map(int,input().split(' '))
even_num_list = filter(lambda x : x % 2 == 0,num_list)

denied = False
for num in even_num_list:
    if num % 3 == 0 or num % 5 == 0:
        continue
    else:
        denied = True
        print('DENIED')
        break

if not denied:
    print('APPROVED')

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

for i in range(N):
    if A[i]%2 == 0 and (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()))

ans = "APPROVED"
for val in A:
    if val % 2 == 0:
        if (val % 3 == 0) or (val % 5 == 0):
            continue
        else:
            ans = "DENIED"
            break
print(ans)

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'
            break

print(ans)

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

n = int(input())
a = list(map(int,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")

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

Solution (Python):
n = int(input())
a = map(int, input().split())
for i in a:
    if i%2==0:
        if i%5 == 0 or i%3==0:
            continue
        else:
            print("DENIED")
            break
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 and A[i]%3 != 0 and A[i]%5 != 0: 
    ans = 'DENIED'
print(ans)

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

Solution (Python):
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: continue
    else: 
      ok = False
      break
print("APPROVED" if ok else "DENIED")

Solution (Python):
import sys
input = sys.stdin.readline
from collections import *

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

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

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()
else:
    print('APPROVED')

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
def main():
    N = int(input())
    A = list(map(int,input().split()))
    for e in A:
        if e%2 == 0:
            if e%3 != 0 and e%5 != 0:
                print("DENIED")
                exit(0)
    print("APPROVED")

if __name__ == '__main__':
    main()

Solution (Python):

n = int(input())
a = list(map(int, input().split()))
ans = "APPROVED"
for ai in a:
    if ai % 2 == 0:
        if ai % 3 != 0 and ai % 5 != 0:
            ans = "DENIED"
            break
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 and i % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')

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

ANS = 'APPROVED'
for i in range(len(A)):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            pass
        else:
            ANS = 'DENIED'

print(ANS)

Solution (Python):

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    _ = readline()
    As = map(int, readline().split())

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


if __name__ == '__main__':
    main()

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

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


flag=True
for i in range(len(A)):
    if A[i]%2==0:
        if (A[i]%3)*(A[i]%5)!=0:
            print('DENIED')
            flag=False
            break
if flag:
    print('APPROVED')

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

if all([list_a[i]%3==0 or list_a[i]%5==0 for i in range(len(list_a))]):
  print('APPROVED')
else:
  print('DENIED')

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



for i in a :
  if i%2 == 1 :
    continue
  else :
    if i % 3 == 0 or i % 5 == 0 :
      continue
    else :
      ck = False
      break
else : 
  ck = True

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

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

for l in a:
    if l%2==0:
        if (l%3!=0)&(l%5!=0):
            print("DENIED")
            exit()
print("APPROVED")

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

flag = True
for x in a:
    if (x % 2 == 0) and (x % 3 != 0 and x % 5 != 0):
        flag = False
        break

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

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

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

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

print('APPROVED')

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

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

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

lis = [i for i in A if i%2 == 0 ]

lis2 = [i for i in lis if i%3 != 0]

lis3 = [i for i in lis2 if i%5 != 0]

if len(lis3) > 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:
      continue
    else:
      print("DENIED")
      break
else:
  print("APPROVED")

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

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
g_count = 0
n_count = 0
for i in a:
  if (i % 2) == 0:
    g_count += 1
    if (i % 3) == 0 or (i % 5) == 0:
      n_count += 1
if g_count == n_count:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
N = int(input())
A = 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())
A=list(map(int,input().split()))
isApprove=True
for i in range(n):
  if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
    isApprove=False
    break
print('APPROVED' if isApprove else 'DENIED')

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

Solution (Python):
N = int(input())
A = [int(i) for i in 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)