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, re
from collections import deque, defaultdict, Counter, OrderedDict
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log
from heapq import heappush, heappop, heapify, nlargest, nsmallest
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def list2d(a, b, c): return [[c] * b for i in range(a)]
def sortListWithIndex(listOfTuples, idx):   return (sorted(listOfTuples, key=lambda x: x[idx]))
def sortDictWithVal(passedDic):
    temp = sorted(passedDic.items(), key=lambda kv: (kv[1], kv[0]))
    toret = {}
    for tup in temp:
        toret[tup[0]] = tup[1]
    return toret
def sortDictWithKey(passedDic):
    return dict(OrderedDict(sorted(passedDic.items())))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()

a = LIST()
flag = 0
for el in a:
    if(el%2==0):
        if(el%3==0 or el%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()))
ans = "APPROVED"

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

print(ans)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

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):
import sys

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")
    sys.exit()
print("APPROVED")

Solution (Python):
def main():
    N = int(input())
    l = list(map(int, input().split()))
    l2 = []
    for i in range(len(l)):
        if l[i] % 2 == 0:
            l2.append(l[i])
    for i in range(len(l2)):
        if not l2[i] % 3 == 0 and not l2[i] % 5 == 0:
            print('DENIED')
            return
    print('APPROVED')

main()

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

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


if __name__ == '__main__':
    main()

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

n, s, f = int(input()), list(map(int, input().split())), True
for e in s:
  if not e & 1:
    if 0 not in [e % 3, e % 5]: f = False; break
print('APPROVED' if f else 'DENIED')

Solution (Python):
N = int(input())
A = [int(n) for n in input().split() if int(n)%2==0]
c = 0
for a in A:
    if a%3==0 or a%5==0:
        c += 1
print('APPROVED' if c==len(A) else '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]%5!=0 and a[i]%3!=0:
            print('DENIED')
            break
else:
    print('APPROVED')

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

Solution (Python):
from sys import exit

N = int(input())

for i in input().split():
    if int(i) % 2 == 0:
        if int(i) % 3 != 0 and int(i) % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

Solution (Python):
from sys import exit
N = int(input())
A = list(map(int,input().split()))

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

print("APPROVED")

Solution (Python):


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

def main(A):
    for a in A:
        if a%2 ==1:
            continue
        if (a%3 != 0) and (a%5 != 0):
            return "DENIED"
    return "APPROVED"

if __name__ == "__main__":
    print(main(A))

Solution (Python):
n = int(input())
A = list(map(int,input().split()))
cnt = 0
ans = "APPROVED"
for i in A:
    if i%2 ==1:
        continue
    if i%2 ==0:
        if (i%3 != 0) and (i%5 != 0):
            cnt += 1
if cnt != 0:
    ans = "DENIED"
print(ans)

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

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *A = map(int, read().split())
    
    approved = True
    for a in A:
        if a % 2 == 0 and a % 3 and a % 5:
            approved = False
            break
    if approved:
        print('APPROVED')
    else:
        print('DENIED')
    
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

N=int(input())
A=list(map(int,input().split()))
B=[]
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):
    print("DENIED")
    sys.exit()
print("APPROVED")

Solution (Python):


import sys
input=sys.stdin.readline

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")
                exit()
    print("APPROVED")
    
    
if __name__=="__main__":
    main()

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
flg = True
for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flg = False
print("APPROVED" if flg is True else "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(0)
print("APPROVED")

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 = list(map(int,input().split()))

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
flag = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = False

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

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

for i in v:
	if(i%2==0 and i%3!=0 and i%5!=0):
		t = False

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

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

Solution (Python):
def LI(): return map(int,input().split())
def I() :return int(input())

n=I()
lst=list(LI())
for i in lst:
    if i %2==0:
        if i % 3==0 or i % 5==0:
            continue
        else:
            print("DENIED")
            break
else:print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = 0
even = 0
for i in a:
  if i % 2 == 0:
    even += 1
  if i % 2 == 0 and (i % 3 == 0 or i % 5 ==0):
    b += 1
if b == even:
  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 a % 3 != 0 and a % 5 != 0:
        print("DENIED")
        exit()

print("APPROVED")

Solution (Python):
input()
l= list(map(int, input().split()))
e = list(filter(lambda i : i%2==0 , l))
s = set('APPROVED' if (a%3==0 or a%5==0) else 'DENIED' for a in e)
print('DENIED' if s.__contains__('DENIED') else 'APPROVED')

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

err = False
for ai in a:
  if ai % 2 == 0:
    if ai % 3 != 0 and ai % 5 != 0:
      err = True

print("DENIED" if err else "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()))
flag = False

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

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

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

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

print('APPROVED')

Solution (Python):

n, *a = map(int, open(0).read().split())
a = [i for i in a if i % 2 == 0 and i % 3 != 0 and i % 5 != 0]
print(["APPROVED", "DENIED"][len(a) > 0])

Solution (Python):
import math

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

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

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

print("APPROVED")

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

    s = True
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                continue
            s = False
            break

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


if __name__ == "__main__":
    main()

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'
      break
    
print(ans)

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

A_eve = []
ans = 'APPROVED'

for i in A:
  if i % 2 == 0:
    A_eve.append(i)
    
for j in A_eve:
  if j % 3 != 0 and j % 5 != 0:
    ans = 'DENIED'
    break
    
print(ans)

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

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

ll = []
for i in l :
  if i%2 == 0:
    ll.append(i)

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

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
flag=True
for i in range(n):
  t=a[i]
  if t%2==1 or t%3==0 or t%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()))
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 = map(int, input().split())
c = 0
 
for v in a:
  if v % 2 == 0 and v % 3 != 0 and v % 5 != 0:
    c += 1
 
print("APPROVED" if c==0 else "DENIED")

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

for v in a:
  if v % 2 == 0 and v % 3 != 0 and v % 5 != 0:
    c += 1

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

Solution (Python):
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(readline())
A = list(map(int,readline().split()))
for a in A:
    if a % 2 == 0 and (a % 3 != 0 and a % 5 != 0) : 
        print('DENIED')
        sys.exit()
print('APPROVED')

Solution (Python):
import itertools
import functools
import math
from collections import Counter
from itertools import combinations
import re


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

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

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

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

for A in As:
    if A%2 == 0:
        if not (A%3 == 0 or A%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 and A[i]%5!=0:
      print('DENIED')
      exit()
print('APPROVED')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
flag = True
for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flag = False
            break

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

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

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

F=True
for a in A:
    F&=((a%2==1) or (a%3==0) or (a%5==0))

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

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

flg = True
for i in range(n):
  if a[i]%2 == 0:
    if a[i]%3 == 0 or a[i]%5 == 0:
      pass
    else:
      flg = False
if flg: print("APPROVED")
else: print("DENIED")

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

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

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

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

if n == 0:
    print('APPROVED')
elif n == 1:
    print('DENIED')

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

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

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

even_numbers = []
for i in numbers:
  if i % 2 == 0:
    even_numbers.append(i)

answers = []
for i in even_numbers:
  if i % 3 == 0 or i % 5 == 0:
    answers.append(i)

if even_numbers == answers:
  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())
A = list(map(int, input().split()))
for A_i in A:
    if A_i % 2 == 0:
        if not ((A_i % 3 == 0) or (A_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*3) == 0) or(A[i]%(2*5) == 0) or( A[i]%(2) == 1):
        flag = 1
    else:
        flag = 0
        print('DENIED')
        break
if flag == 1:
    print('APPROVED' )

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
newA = []
count = 0
ans = 0

for i in range(N):
    if A[i]%2 ==0:
        newA.append(A[i])
        count += 1

for j in range(count):
    if newA[j]%3 == 0 or newA[j]%5== 0:
        ans += 1

if ans == count:
    print("APPROVED")
else:
    print("DENIED")

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

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

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

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

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

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:
        ans=('DENIED')
        break
    else:
        ans=('APPROVED')
print(ans)

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


def is_approve(a:list):
  ans = False
  for num in a:
    if num % 2 == 1 :
      ans = True
    elif num % 3 == 0 or num % 5 == 0:
      ans = True
    else:
      ans = False
      break
  return ans

if is_approve(a):
  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)):
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

Solution (Python):
import sys

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

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))
for i in range(n):
  if lst[i] % 2 == 0 and (lst[i] % 3 != 0 and lst[i] % 5 != 0):
    print('DENIED')
    exit()
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 and i%5 !=0:
      ans= "DENIED"
print(ans)

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

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

cond = True

for i in arr:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0: continue
    else:
      cond = False
      break
      
if cond: print("APPROVED")
else: print("DENIED")

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

def isApprove(_len, nums):
  for i in range(_len):
    if int(nums[i]) % 2 == 0:
      if int(nums[i]) % 3 != 0 and int(nums[i]) % 5 != 0:
        return False
  
  return True

print('APPROVED' if isApprove(_len, nums) else 'DENIED')

Solution (Python):
len=int(input())
list = input().split(" ")
msg="DENIED"
for i in range(len):
  if int(list[i])%2==0 and (int(list[i])%3==0 or int(list[i])%5==0):
    msg="APPROVED"
  elif int(list[i])%2==0:
    msg="DENIED"
    break
  else:
    msg="APPROVED"  
print(msg)

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

for _ in  A:
    if _ % 2 == 0:
        if _ % 3 == 0 or _ % 5 == 0:
            ans *= 1
        else:
            ans *= 0

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

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

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

Solution (Python):
N=int(input())
a1=input().split()
a2=[int(i) for i in a1]
for x in a2:
    if x%2==0:
        if x%3==0:
            continue
        if x%5==0:
            continue
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

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

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

for x in a:
    if x % 2 == 0:
        if x % 3 == 0:
            continue
        if x % 5 == 0:
            continue
        print( "DENIED" )
        break
else:
    print( "APPROVED" )

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

Solution (Python):
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int 
float 


for name in fruits: 
    print(name)


list0 = [] 
list0 = [1,2,3,4] 
list0 = [0]*10 
list1= [i for i in range(10)] 
list1 = list(map(int, input().split()))　
number=[int(input()) for i in range(int(input()))] 
list1 = list1 + [6, 7, 8] 
list2.append(34) 
list.insert(3,10) 
len(list4) 
max(sa) 
list5.count(2) 
list1.sort() 
list1.sort(reverse=True)  
set(list1) 
sum([2,3,   ,3]) 

abs(a) 
max(a,b) min(a,b) 
text1 = text1.replace("34","test") 

exit(0) 

cumsum(リスト) 
cumsum_number(N,K,x) 
"""
N=int(input())
number=list(map(int,input().split()))
number1=[i for i in number if i%2==0]
S=len(number1)
ans=0
for j in number1:
    if j%3==0 or j%5==0:
        ans += 1
if S==ans:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):


n = int(input())
s = list(map(int, input().split()))
valid = True

for i in s:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            valid = False

if valid == True:
    print("APPROVED")
elif valid == False:
    print("DENIED")

Solution (Python):
n = int(input())
A = list(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')

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):
n = int(input())
a = list(map(int, input().split()))
b = True
for x in a:
    if x%2 == 0:
        if x%3 != 0 and x%5 != 0:
            b = False
print("APPROVED" if b else "DENIED")

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

Solution (Python):
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N = I()
    A = numpy.array(LI())
    A_mod2 = A[A%2==0]
    is_approved = ((A_mod2%3==0)|(A_mod2%5==0)).all(axis=0)
    print("APPROVED" if is_approved else "DENIED")

main()

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

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

Aeven = []
for i in A:
  if i%2 == 0:
    Aeven.append(i)
    
for i in Aeven:
  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()))
k = 'APPROVED'
for i in A:
  if i % 2 == 0:
    if i % 3 == 0:
      pass
    elif i % 5 == 0:
      pass
    else:
      k = 'DENIED'
print(k)

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:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans = 'DENIED'
print(ans)

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 or i % 5 == 0:
            pass
        else:
            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(map(int, input().split()))

for i in range(n):
    if a[i] % 2 == 1:
        continue
    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()))
x=0
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            x=1
            break
if x==1:
    print('DENIED')
else:
    print('APPROVED')

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

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


for i in range(len(A)):
	if A[i]%2 != 0:
		A[i] = 0

for t in range(len(A)):
	if A[t] > 0:
		if A[t]%3 == 0 or A[t]%5 == 0:
			A[t] = 0
print("APPROVED" if sum(A) == 0  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 or i%5==0:
      continue
    else:
      print("DENIED")
      exit()
print("APPROVED")

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

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
DENY = [I for I in A if I%2==0 and I%3!=0 and I%5!=0]
if len(DENY)>=1:
    print('DENIED')
else:
    print('APPROVED')

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

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):
def solve():
    n = int(input())
    a = map(int, input().split())
    even = [e for e in a if e % 2 == 0]
    for i in even:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            exit()
    print('APPROVED')


if __name__ == '__main__':
    solve()

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

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

ret = "APPROVED"
for a in a_list:
    if a % 2 == 0 and not (a % 3 == 0 or a % 5 == 0):
        ret = "DENIED"
        break

print("{}".format(ret))

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])
for i in b:
    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(n):
    if a[i]%2 == 0 and not (a[i]%3 == 0 or a[i]%5 == 0):
        ans = 'DENIED'
        break
print(ans)