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())
bomb = []
kotae = []
hako = list(map(int, input().split()))
for h in hako:
  if h % 2 == 0:
    bomb.append(h)
for h in bomb:
  if h % 3 == 0 or h % 5 == 0:
    kotae.append(h)
if len(kotae) == len(bomb):
  print("APPROVED")
else:
  print("DENIED")

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

chk = 0
for i in range(0,N):
    if A[i]%2 == 0:
        if A[i]%3 == 0 or A[i]%5 == 0:
            continue
        else:
            chk += 1

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

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

result = True
for a in A:
    aint = int(a)
    if aint % 2 == 0:
        if aint % 3 != 0 and aint % 5 != 0:
            result = False

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

Solution (Python):
import sys
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):
      continue
    else:
      print("DENIED")
      sys.exit()
      
print("APPROVED")

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

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

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

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

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
lf = list(filter(lambda x:x%2==0,l))
print(['DENIED','APPROVED'][all([i%3==0 or i%5==0 for i in lf])])

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

def f(a):
  if (a % 2 == 0):
    if (a % 3 == 0 or a % 5 == 0):
      return 1
    else:
  	  return 0
  return 1

ans = list(map(f,A))
if (len(ans) == sum(ans)):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):




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

U='APPROVED'


jj=0
for jj in range(len(A)):
    
    A2=A[jj]%2
    A3=A[jj]%3
    A5=A[jj]%5
    if A2==0:
        if A3!=0 and A5!=0:
            U='DENIED'
            break


print(U)

Solution (Python):
n = input()
n = int(n)
ary = (int(x) for x in input().split())
flg = True
for num in ary:
    if num % 2 == 0:
        
        if num % 3 == 0:
            
            pass
        elif num % 5 == 0:
            
            pass
        else:
            flg = False
    else:
        pass
        
if flg:
    print("APPROVED")
else:
    print("DENIED")

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

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

print("APPROVED")

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

Solution (Python):


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

for num in A:
    if num % 2 == 0:
        if (num % 3 == 0) or (num % 5 == 0):
            pass
        else:
            res += 1

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

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

Solution (Python):



def main():
    _ = int(input())
    ints = list(map(int, input().split(' ')))

    for int_ in ints:
        if int_ % 2 == 0:
            if int_ % 3 == 0 or int_ % 5 == 0:
                pass
            else:
                print('DENIED')
                return 0
        else:
            pass

    print('APPROVED')

    return 0


if __name__ == '__main__':
    main()

Solution (Python):

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

even = []
for i in A:
    if i % 2 == 0:
        even.append(i)

if even == []:
    print('APPROVED')
    exit()

for i in even:
    if i % 3 == 0 or i % 5 == 0:
        pass
    else:
        print('DENIED')
        exit()
    
print('APPROVED')

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

Solution (Python):
lenght = int(input())
allNum = input().split()
denied = False
for i in allNum:
  i = int(i)
  if(i % 2 == 0):
    if(i % 3 == 0 or i % 5 == 0):
      continue
    else:
      denied = True
      break
if(denied):
  print("DENIED")
else:
  print("APPROVED")

Solution (Python):
N=int(input())
mylist=list(map(int, input().split()))
answer=0

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

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]/2)
fl=0
for i in range(len(b)):
    if b[i]%3==0 or b[i]%5==0:
        fl+=0
    else:
        fl+=1
if fl==0:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
_ = input()

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

s = "APPROVED"

for i in a:
    if i % 2 == 1:
        continue
    if i % 3 == 0:
        continue
    if i % 5 == 0:
        continue
    s = "DENIED"
print(s)

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

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

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

if c:
    print("APPROVED")

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

x = [i for i in a if i % 2 == 0]
for i in x:
    if i % 3 == 0 or i % 10 == 0:
        count += 1

if len(x) == count:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    A = map(int, input().split())

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


main()

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

L_even = []
for i in range(0,n):
    if L_A[i] % 2 == 0:
        L_even.append(L_A[i])

ans = 0
for i in range(0,len(L_even)):
    if L_even[i] % 3 == 0 or L_even[i] % 5 == 0:
        ans += 0
    else:
     ans += 1

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

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


yesno = True

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

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

Solution (Python):


def main():
    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:
                flag=True
            else:
                flag=False
                break

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

if __name__ == '__main__':
    main()

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 = int(input())
an = [int(x) for x in input().split()]

for i in an:
    if i % 2 == 0:
        flag = False
        if i % 3 == 0:
            flag = True
        if i % 5 == 0:
            flag = True
        if flag == False:
            print('DENIED')
            exit()

print('APPROVED')

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

Solution (Python):
n = int(input())
a = [int(e) for e in input().split()]
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:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
a = [int(x) for x in stdin.readline().rstrip().split()]

result = 'APPROVED'
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            result = 'DENIED'


print(result)

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=map(int,input().split())
List=list(map(int,input().split()))
List_even = [i for i in List if i % 2 == 0]
count=len(List_even)
ok_counter=0
for i in range(count):
    if List_even[i] % 3 == 0:
        ok_counter+=1
        continue
    if List_even[i] % 5 == 0:
        ok_counter+=1
        continue
if ok_counter == count:
    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==0 and (A[i]%3!=0 and A[i]%5!=0):
    print("DENIED")
    count=1
    break

if count==0:
  print("APPROVED")

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

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

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

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

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

flag = 1

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

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

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

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

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

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

Solution (Python):

N = int(input())
A = input().split()



for i in A:
	n = int(i)
	
	if n % 2 == 0:
		if n%3==0 or n%5==0:
			continue
		else:
			print("DENIED")
			exit()

print("APPROVED")

Solution (Python):
n = int(input())
a = [int(i) for i in 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 == 0:
    print("APPROVED")
else:
    print("DENIED")

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

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

Solution (Python):
n = int(input())
lis = list(map(int, input().split()))
flug = 0
for i in lis:
    if i % 2 == 0:
        if (i % 3 == 0) or (i % 5 == 0):
            pass
        else:
            flug = 1

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

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

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

if len(l) > 0:
    x = 0
    for i in l:
        if (i % 3 == 0) or (i % 5 == 0):
            x += 1
    if len(l) == x:
        print('APPROVED')
    else:
        print('DENIED')
else:
    print('APPROVED')

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]%6)*(b[i]%10)!=0:
    print('DENIED')
    sys.exit()
print('APPROVED')

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

count = 0
for i in range(len(even_num)):
    if even_num[i] % 3 == 0 or even_num[i] % 5 == 0:
        count += 1

if count == len(even_num):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
e = []
ans = 'APPROVED'

for i in l:
    if i % 2 == 0: e.append(i)

for i in e:
    if not i % 3 == 0 and not i % 5 == 0:
        ans = 'DENIED'
        break

print(ans)

Solution (Python):

import numpy as np
stdin = open(0)

A = np.fromstring(stdin.read(), np.int64, sep=' ')[1:]
A = A[A % 2 == 0]
if np.all((A % 3 == 0) | (A % 5 == 0)):
    print('APPROVED')
else:
    print('DENIED')

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

judege=0
for num in a:
    if num%2==0:
        if num%3==0 or num%5==0:
            pass
        else:
            judege+=1

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

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

Solution (Python):
import sys,collections,math,random,fractions,bisect;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]
 
N = I()
a = I()
ans = "APPROVED"
for e in a:
    if e%2 == 0:
        if e/3 != e//3 and e/5 != e//5:
            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 or i % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()
else:
    print('APPROVED')

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

flag = True
for i in l:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            flag = False
            break

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

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

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

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

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

for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 ==0:
            judge.append("APPROVED")
        else:
            judge.append("DENIED")
    else:
        pass

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

Solution (Python):
N = int(input())
A_list = list(map(int,input().split()))
even_list = [i for i in A_list if i % 2 == 0]
flag = 0
for i in even_list:
  if i % 3 == 0 or i % 5 == 0:
    continue
  else:
    flag = 1
if flag == 0:
  print("APPROVED")
else:
  print("DENIED")

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

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

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

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

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

res = True
for a in A:
    if a % 2 == 0:
        if (a % 3 == 0) or (a % 5 == 0):
            continue
        else:
            res = False

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

Solution (Python):
import sys
 
t = sys.stdin.read()
a = map(int, t.split("\n")[1].split())
 
def check(a):
    for b in a:
        if b % 2 == 0:
            if b % 3 == 0 or b % 5 == 0:
                pass
            else:
                return False
    return True
 
if check(a):
    print "APPROVED"
else:
    print "DENIED"

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

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

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

Solution (Python):
def main():
  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'
    else:
      pass
  print(ans)
if __name__ == '__main__':
  main()

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

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

print(ans)

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

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

print(judge)

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

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

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

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

Solution (Python):
N=int(input())
s=list(map(int, input().split()))
A=[]
for i in range(len(s)):
  a=int(s[i])
  A.append(a)
B=[]
for i in range(len(A)):
  if A[i]%2==0:
    b=A[i]
    B.append(b)
C=[]
for i in range(len(B)):
  if (B[i]%3==0 or B[i]%5==0):
    c=B[i]
    C.append(c)
if len(B)==len(C):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):

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

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

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

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):
def is_approved(num):

    if num % 2 == 1:
        return True
    elif num % 3 == 0 or num % 5 == 0:
        return True
    
    return False

def main():

    n = int(input())
    an = list(map(int,input().split()[:n]))

    for num in an:
        if not is_approved(num):
            print('DENIED')
            exit()
    print('APPROVED')

if __name__ == "__main__":
    main()

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


if __name__=='__main__':
    main()

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

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

f = False
for a in aa:
  if a % 2 == 0:
    if (a % 3 != 0) and (a % 5 != 0):
      print('DENIED')
      f = True
      break
if not f:
  print('APPROVED')

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

check = 0
for num in nums:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 == 0:
            continue
        else:
            check += 1
            
if check == 0:
    print("APPROVED")
else:
    print("DENIED")

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

    return ans

print(solve())

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

res = "APPROVED"

for i in A_lst:
    if i % 2 == 0:
        if i%3!=0 and i%5!=0:
            res = "DENIED"
            break
        
print(res)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
even=[]
for a in A:
    if a%2==0:
        even.append(a)
    
if len(even)==0:
    print("APPROVED")
    exit()
    
ans=False
    
for e in even:
    if e%3==0 or e%5==0:
        ans=True
    else:
        ans=False
        break

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

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

for val in A:
  if val % 2 == 0:
    if val % 3 != 0 and val % 5 != 0:
      flag = 1 
    
if flag == 0:
  print("APPROVED")
elif flag == 1:
  print("DENIED")

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:
            continue
        else:
            flag = False

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

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

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

tmp = []
for _a in a:
  if _a % 2 == 0:
    tmp.append(_a)

tmp2 = []
for t in tmp:
  if t % 3 == 0 or t % 5 == 0:
    tmp2.append(True)
  else:
    tmp2.append(False)

if False in tmp2:
  print('DENIED')
else:
  print('APPROVED')

Solution (Python):
N = int(input())
A = [int(s) for s in input().split()]
evenA = [i for i in A if i%2 == 0]
flg = True
for i in evenA:
  if i%3 != 0 and i%5 != 0:
    flg = False
if flg:
  print("APPROVED")
else:
  print("DENIED")

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

Solution (Python):


import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        
        
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    a = [int(e) for e in lines[1].split(" ")]

    return (n, a)


def solve(n, a):

    even = [e for e in a if e % 2 == 0]    

    result = 'APPROVED'
    for i in range(len(even)):
        e = even[i]
        if e % 3 == 0:
            pass 
        elif e % 5 == 0:
            pass
        else:
            result = 'DENIED'
            break


    return result
    


def main():
    
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

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

flg = 0

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

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

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

flag = True

for num in numbers:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flag = False
            break
            
if flag:
    print('APPROVED')
else :
    print('DENIED')

Solution (Python):
def calc(nums):
    for n in nums:
        if n % 2 == 0:
            if not (n % 3 == 0 or n % 5 == 0):
                return False
    return True

if __name__ == '__main__':
    N = int(input())
    nums = list(map(int, input().split()))
    if calc(nums):
        print('APPROVED')
    else:
        print('DENIED')

Solution (Python):
import sys

input()
input_line = [int(i) for i in input().split(" ") if int(i) % 2 == 0]

if input_line == []:
  print("APPROVED")
  sys.exit()

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

Solution (Python):
n = int(input())
an = input().split(' ')

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

print(ans)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
k = 0
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            k += 1
    else:
        pass

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

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

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

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

evens = list()
for number in numbers:
    if(number%2 == 0):
        evens.append(number)

illegal = 0
for even in evens:
    if(even % 3 != 0 and even % 5 != 0):
        illegal += 1

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

Solution (Python):
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
if flag == 1:
	print('APPROVED')
else:
	print('DENIED')

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

Solution (Python):
N = int(input())
ALis = list(map(int,input().split()))
Flag = True

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

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

Solution (Python):
def shinsa(data):
    for i in data:
        if i % 2 == 0:
            if i % 3 == 0 or i % 5 == 0:
                continue
            else:
                return 'DENIED'

    return 'APPROVED'

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

result = shinsa(data)
print(result)

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

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

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

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

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

flag = 1

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

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

for a in As:
    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):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")