peterverebics/CodeNet_Python_118 huggingface dataset:
N=int(input())
a1=input().split()
a2=[int(i) for i in a1]
empty=[]
for i in a2:
    if i%2==1:
        a2.remove(i)
for i in a2:
    if i%3==0 or i%5==0:
        empty.append(i)
print('APPROVED' if empty==a2 else 'DENIED')
n = int(input())
al = list(map(int, input().split()))

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

print(ans)
n = int(input())
a = list(map(int, input().split()))
ite = 0
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 ==0:
            ite += 1
        else:
            break
    else:
        break
if ite >= 1:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
lis = list(map(int,input().split()))
result = "DENIED"
for i in lis:
    if i %2 ==0:
        if i %3 ==0 or i%5 ==0:
            result = "APPROVED"
        else :
            result = "DENIED"
            break
print(result)
import sys
N = int(input())
arr = list(map(int, input().split()))

for i in range(len(arr)):
    if arr[i] % 2 == 0 and (arr[i] % 3 != 0 and arr[i] % 5 != 0):
        print("DENIED")
        break
    else:
        print("APPRPVED")
# getting input on a variable 
aa = input()
a = list(map(int, input().split()))

check = None
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            check = True
        else:
            check = False
            break
    
if check:
    print("APPROVED")
else:
    print("DENIED")
N=int(input())
A=list(map(int, input().split())) 

ans = 'DENIED'
for i in A:
  if i%2==0:
    #print(i)
    #print(i%3, i%5)
    if i%3==0 or i%5==0:
      ans = 'APPROVED'
    else:
      ans = 'DENIED'
      break

print(ans)
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0 and ( i % 3 != 0 and i % 5 != 0):
      is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")
N = int(input())

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

isOk = False
for i in A:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            isOk = True
        else:
            isOk = False
            break


if isOk:
    print("APPROVED")
else:
    print("DENIED")
rangeNum = int(input())
n = list(map(int, input().split()))

for ni in range(rangeNum):
    if n[ni]%2 == 0:
        if n[ni]%3 == 0:
            continue
        elif n[ni]%5 == 0:
            continue
        else:
            print("DENIED")
            break
    else:
        continue
print("APPROVED")
n=int(input())
a=list(map(int,input().split()))
cnt=0
while True:
    if cnt>=n:
        print('DENIED')
        break
        
    elif a[cnt]%2==0:
        if a[cnt]%3==0 or a[cnt]%5==0:
            cnt+=1
            continue
        else:
            print('DENIED')
            break
    elif cnt==n:
        print('APPROVED')
        break
    else:
        cnt+=1
        continue
n=int(input())
l=list(map(int,input().split()))
for i in l:
    if i%2==0 and i%3!=0 and i%5==0:
        print("DENIED")
        exit()
print("APPROVED")
n = int(input())
l = list(map(int, input().split()))
def test():
  for i in l:
    if i%2 == 0 and i%3!=0 and i%5!=0:
      return "DENIED"
    return "APPROVED"
  print(test())
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:
      flag = 1
      pass
    else:
      print('DENIED')
      flag = 0
      break
  else:
    pass
  
if flag == 1:
  print('APPROVED')
n = int(input())
A = map(int, input().split())
result = 'APPROVED'
for a in A:
  if a % 2 == 1:
    continue
  if a % 2 == 0:
    if a % 3 != 0 or a % 5 != 0:
      result = 'DENIED'
      break
print(result)
N = int(input())
applist = list(map(int, input().split()))

applist.append(N)
 
flag = 0
for i in applist:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      flag = 1
    else:
      flag = 0
      break

if flag == 1:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
An = list(map(int,input().split()))

for i in An:
    if i%2==0:
        if i%3 !=0 and i%5==0:
            print('DENIED')
            exit()
else:
    print('APPROVED')
N = int(input())
A = [int(x) for x in input().split()]

C = True
count = 0

def check(i):
    if i % 5 == 0 or i % 3 == 0:
        return True
    else:
        return False   
        


for i in A :
    if i % 2 == 0:
        validation =  check(i)
        if validation == False:
            C = False
            break
    else:
      count = count + 1
if count == len(A):
     C = False 

if C:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
arr = list(map(int, input().split()))

for x in arr:
    if ((x % 2) == 0) and (x % 3 or x % 5):
        print("DENIED")
        break
else:
    print("APPROVED")
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("APROVED")
else:
    print("DENIED")
n = int(input())
s = map(int, input().split())
tmp = []
for i in s:
    if i % 2 == 0:
        tmp.append(i)

ans = 'DENIED'
if len(tmp) == 0:
    print(ans)

for i in tmp:
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        print(ans)
        exit()
print('APPROVED')
N = int(input())
A = list(map(int, input().split()))
count = 0
check = 0
for i in A:
    if i%2 == 0:
        count += 1
        if i%3 == 0 or i%5 == 0:
            check += 1
if count == check:
	print('APROVED')
else:
	print('DENIED')
n = int(input())
a = list(map(int, input().split()))
ch3 = 0
ch5 = 0

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0:
            ch3 = 1
        if a[i] % 5 == 0:
            ch5 = 1

if ch3*ch5==1:
    ans='APPROVED'
else:
    ans = 'DENIED'
    
print(ans)
N = int(input())
data = list(input().split())
sw = 0
for i in range(0,len(data)):
    if int(data[i]) % 2 == 0:
        if int(data[i]) % 3 == 0 or int(data[i]) % 5 == 0:
            sw = 1

if sw == 1:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = [int(x) for x in input().split()]
p = 0
for i in range(n):
    
    if a[i]%2 == 0 and a[i]%3 != 0:
        p += 1
    else:
        p = p
    if a[i]%2 == 0 and a[i]%5 != 0:
        p += 1
    else:
        p = p
if p > 0:
    print("DENIED")
else:
    print("APPROVED")
import sys
a=input()
arr = list(map(int, input().split()))
c=False
for i in arr:
	if(i%2==0):
		if(i%3==0 or i%5==0 ):
			c=True	
		else:
			print("DENIED")
			c=False
			sys.exit()	
if(c==True):
	print("APPROVED")	
else:
	print("DENIED")
N=int(input())
a1=input().split()
a2=[int(i) for i in a1]
empty=[]
for i in a2:
    if i%2!=0:
        a2.remove(i)
for i in a2:
    if i%3==0:
        empty.append(i)
        continue
    elif i%5==0:
        empty.append(i)
print('APPROVED' if len(empty)==len(a2) else 'DENIED')
n = int(input())
list = [int(x) for x in input().split(" ") if int(x) % 2 == 0]
result = 'DENIED'
for i in range(len(list)):
    if list[i]%3!=0 and list[i]%5!=0:
        break
    else:
        result = 'APPROVED'
print(result)
import sys

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

for i in range(n):
  a = li[i]
  if a%2 ==0:
    if (a % 3 == 0 or a % 5 == 0)==False:
      print("DENIED")
      sys.exit()

print("PASS")
n = int(input())
a = list(map(int, input().split()))

for i in a:
    if not i%2 and i%3 and i%5:
        print("DENIED")
        break
    else:
        print("APPROVED")
n=int(input())
seq=input().split()
check=0
for i in range(n):
  if int(seq[i])%2==0:
    if int(seq[i])%3!=0 or int(seq[i])%5!=0:
      check+=1
if check==0:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
lists = list(map(int,input().split()))
flg = True
for check in lists:
    if(check % 2 == 0):
        if(check & 3 == 0 or check % 5 == 0):
            print('APPROVED')
            flg = False
if(flg == True):
  print('DENIED')
n = int(input())
numbers = [int(x) for x in input().split()]
flag = 'APPROVED'
for number in numbers:
  if number%2==0 and (number % 3 == 0 or number % 5 == 0):
    continue
  else:
    flag = 'DENIED'
    break
print(flag)
a = int(input())
 
b=list(map(int, input().split())) 
x = 0
 
if (a==0) :
	print('DENIED')
elif (b.count(0) > 0):
	print('DENIED')
else:
  for i in b:
      if i % a == 0:
          x += 1
  if x == len(b):
    print('APPROVED')
  else:
    print('DENIED')
a = int(input())
 
b=list(map(int, input().split())) 
x = 0
 
if (a==0) :
	print('DENIED')
elif (b.count(0) > 0):
	print('DENIED')
else:
  for i in b:
      if (i % a == 0) and (i % 2 == 0):
          x += 1
if x == len(b):
  print('APPROVED')
else :
  print('DENIED')
import numpy as np
import sys
n = 5
a = np.array([6, 7, 9, 10, 31])

for i in range(n):
    if a[i]%3 != 0 and a[i]%5 != 0:
        print("APPROVED")
        sys.exit()

print("DENIED")
n =int(input())
A = [0 if int(x) % 2 == 1 or int(x) % 30 == 0 
     else 1 for x in input().split()]
for i in A:
    if i ==0:
        print("APPROVED")
    else:
        print("DENIED")
n = int(input())
a = [int(i) for i in input().split()]
x = 0
for j in range(0,n):
  if not (((a[j] % 2) == 0) and (((a[j] % 3) != 0) and (a[j] % 5 != 0))):
    x = 1
if x == 1:
  print('APPROVED')
else:
  print('DENIED')
n=int(input())

a=list(map(int,input().split()))
b=0
for i in range(len(a)-1):
    if a[i]//2==0:
        if a[i]//3==0 or a[i]//5==0:
            b=b+1
    else:
        b=b+1

if b==n:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = list(map(int, input().split()))
check1 = 0
check2 = 0
for i in range(N):
    if A[i]//2 == 0:
        check1+=1
for i in range(N):
    if A[i]//2 == 0:
        if A[i]//3 == 0 or A[i]//5 == 0 :
            check2+=1
        else:
            check2+=0
    else:
        pass
if check1 == check2:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
anums = list(map(int, input().split()))

for anum in anums:
    if (anum % 2 == 0) and ((anum % 3 == 0) or (anum % 5 == 0)):
        result = 'APPROVED'
        break
    else:
        result = 'DENIED'

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

ans = 'APPROVED'

for i in range(N):
  if A[i] % 2 == 0 and A[i] % 6 != 0 and A[i] % 10 != 0:
    print(A[i])
    ans = 'DENIED'
    break

print(ans)
a = int(input())
b = list(map(int, input().split()))
b = [c for c in b if c % 2 == 0]
if len(b) == 0:
    print('DENIED')
for i in b:
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        print('DENIED')
        break
    print('APPROVED')
num=int(input())
youso_list=input().split(' ')
boolean=True

for youso in youso_list:
    magic_num=0
    youso=int(youso)
    if youso%2!=0:
        continue
    
    if youso%3!=0:
        magic_num+=1
        
    if youso%5!=0:
        magic_num+=1
    
    if magic_num==2:
        boolean==False
        break

print(magic_num)
if boolean==False:
    print('DENIED')

elif boolean==True:
    print('APPROVED')
s = int(input())

arr = [int(i) for i in input().split(maxsplit=(s - 1))]

a = []

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


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

if len(a) != 0:
    print('APPROVED')
N=int(input())
List=list(map(int,input().split()))
nList=[e for e in List if e % 2 == 0]
for f in nList:
  if f % 3 == 0 or f % 5 == 0:
    print("APPROVED")
  else:
    print("DENIED")
    break
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            print("DENIED")
            break
    elif i == n-1:
        print("APPROVED")
        break
N = int(input())
*A, = map(int, input().split())
print(A)
B = []
for i in A:
  if i % 2 == 0:
    B.append(i)
C = 0
for l in B:
  if l % 5 == 1 or l % 3 == 0:
    C = C + 1
 
if len(B) == 0:
  print('APPROVED')
elif C/len(B) == 1:
  print('APPROVED')
else:
  print('DENIED')
import sys
input_first = input().split()
input_second = input().split()

N= input_first
paper = [int(i) for i in input_second]


for num in paper:
    if num %2 == 0:
        if  num % 5  == 0 or num % 3 == 0:
            print('APPROVED')
            sys.exit(0)
        else:
            print('DENIED')
            sys.exit(0)


print('DENIED')
N = int(input())
lis = list(map(int,input().split()))
result = "DENIED"
for i in range(N):
    if i %2 ==0:
        if i %3 ==0 or i%5 ==0:
            result = "APPROVED"
        else :
            result = "DENIED"
            break
print(result)
N = int(input())
A = list(map(int,input().split()))
ans=[]
for i in range(N):
    ai=A[i]
    if ai%2==0:
        ans.append(str(ai))
    else:
        continue

if ans==[]:
    print('DENIED')
    exit()

for i in range(len(ans)):
    a = int(ans[i])
    if a%3==0:
        continue
    elif a%5==0:
        continue
    else:
        print('DENIED')
        exit()
print('APPROVED')
N=int(input())
li = list(map(int,input().split()))

for i in li:
  if i%2 ==0:
    if i%3 != 0 and i%5 != 0:
      print('DENIED')
      break
  continue
  print('APPROVED')
c = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
  if (a[i] % 2) == 0:
    if (((a[i] % 3) == 0) or ((a[i] % 5) == 0)):
      b.append(True)
    else: 
      b.append(False)
if (len(b) == 0) or (False in b):
  print("APPROVED")
else:
  print("DENIED")
n=int(input())
l=list(map(int,input().split()))
for i in l:
    if i%2==0 and i%3!=0 or i%5==0:
        print("DENIED")
        exit()
print("APPROVED")
n = int(input())
lst = list(map(int,input().split()))
c = 0
for i in range(n):
  if (lst[i]%2 == 0):
    if (lst[i]%3 == 0 or lst[i]%5 == 0):
      c = 1
if (c == 0):
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
lst = list(map(int,input().split()))
c = 0
for i in range(n):
  if (lst[i]%2 == 0):
    if (lst[i]%3 != 0 or lst[i]%5 != 0):
      c = 1
if (c == 0):
  print("APPROVED")
else:
  print("DENIED")
N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
  if A[i]%2 ==0:
    if A[i]%3==0 or A[i]%5==0:
      flag=0
    else:
      flag=1
print(['APPROVED','DENIED'][flag])
n = int(input())
a = list(map(int,input().split()))

yoki = dame = d = 0

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

if dame >= 1 or (yoki == 0 and d >= 1):
    print("DENIED")
elif yoki >= 1:
    print("APPROVED")
#https://atcoder.jp/contests/abc155/tasks/abc155_b
S_list = [input() for i in range(2)]
S_list_1 = S_list[1].split()

even_list = []
for i in S_list_1:   
    if int(i) % 2 == 0 and int(i) != 0:
        even_list.append(int(i))

if (bool(even_list)) == False:
    even_list =[1]
    
for i in even_list:
    if i % 3 ==0 or i % 5 ==0 :
        result="APPROVED"
    else:
        result="DENIED"
        break
print(result)
def main():  
  N=input()
  A=list(map(int,input().split()))
  for a in A:
    if a%2==0 and  (a%3!=0 or a%5!=0):
      print("DENIED")
      return 
  print("APPROVED")

main()
a = input()
b = list(map(int,input().split()))

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

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

for s in b:
    if s % 3 == 0 or s % 5 == 0:
        c.append(True)
    else:
        c.append(False)
for z in c:

    if not z:
        print("DENIED")
        break
    else:
        print("APPROVED")
        break
rangeNum = int(input())
n = list(map(int, input().split()))

ans = True
for ni in range(rangeNum):
    if n[ni] % 2 == 0:
        if n[ni] % 3 == 0:
            break
        elif n[ni] % 5 == 0:
            break
        else:
            asn = False
    else:
        asn = False
if ans:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
array = list(map(int, input().strip().split()))
count = int(0)
flag = int(0)
for x in range(N):
    if array[x] % 2 == 0:
        count += 1
        if array[x] % 3 == 0 or array[x] % 5 == 0:
            print('APPROVED')
            flag = 1
            break
        else:
            print('DENIED')
            flag = 1
            break
if flag == 0:
    if count == 0:
        print('APPROVED')
        flag = 1
if flag == 0:
    print('DENIED')
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:
            break
        else:
            chk += 1

if chk == 0:
    print("APROVED")
else:
    print("DENIED")
n = int(input())
a = list(map(int, input().split()))
for x in a:
  if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
    print('DENIED')
print('APPROVED')
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:
      print('DENIED')
      flag = False
      break
      
if flag:
  print('APPROVED')
def main():
	# n,m = map(int,input().split())
	n = int(input())
	a = list(map(int,input().split()))
	ans = 0
	den = 0
	for i in range(len(a)):
		if a[i] % 2 == 0:
			if a[i] % 3 == 0 or a[i] % 5 == 0:
				ans = 1
			else:
				den = 1
	if ans == 1 and den == 0:
		print("APPROVED")
	else:
		print("DENIED")
	
 
if __name__ == '__main__':
	main()
n = int(input())
a = list(map(int,input().split()))
flag = 0

for i in a:
  if i % 2 == 0:
    if i % 3 == 0:
      flag = 1
      pass
    elif i % 5 == 0:
      flag = 1
      pass
    else:
      print('DENIED')
      flag = 0
      break
  
if flag == 1:
  print('APPROVED')
#!/usr/bin/env python
# -*- coding: utf-8 -*-
N=int(input())
i = list(map(int, input().split()))
c=0

for k in range(0,N):
  if i[k]%2==0:
    if (i[k]%3!=0) or (i[k]%5!=0):
      c=c+1

if c==0:
  print('APPROVED')
else:
  print('DENIED')
n = int(input())
a = [int(i) for i in input().split()]
x = 0
for j in range(0,n):
  print(a[j])
  if not (((a[j] % 2) == 0) and (((a[j] % 3) != 0) and (a[j] % 5 != 0))):
    x = 1
if x == 1:
  print("DENIED")
else:
  print('APPROVED')
import sys
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:
            print('DENIED')
            sys.exit()
print('APPROVED')
N = int(input())
li = list(map(int,input().split()))
even_li = [x for x in li if x%2 == 0]
ap = 0
for i in even_li:
    if i % 3 == 0 or i % 5 == 0:
        ap += 1
if even_li == []:
    print("DENIED")
elif ap == len(even_li):
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = [int(i) for i in input().split()]
x = 0
for j in range(0,n):
  if not (((a[j] % 2) == 0) and (((a[j] % 3) != 0) or (a[j] % 5 != 0))):
    x = 1
if x == 1:
  print('APPROVED')
else:
  print('DENIED')
# getting input on a variable 
aa = input()
a = list(map(int, input().split()))

check = None
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            check = True
        else:
            check = False
            break
    else:
        check = False
    
if check:
    print("APPROVED")
else:
    print("DENIED")
def check(n, da):
    for i in da:
        if i%2 == 0:
            if not(i%3 == 0 or n%5 == 0):
                return False
    return True


n = int(input())
#s = input()
#a, b, c = map(int,input().split())
da = list(map(int,input().split()))

if check(n, da):
    print('APPROVED')
else:
    print('DENIED')
N=int(input())
l=[int(x) for x in input().rstrip().split()]
flag=0
for i in l:
  if i%2==0:
    if (i%5==0 or i%3==0):
      flag=1
    else:
      flag=0
      break
if flag==1:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
l = list(map(int,input().split()))
flag = False
for i in l:
  if i%2==0:
    if i%3!=0 or i%5!=0:
      flag=True
      break
if not flag:
  print('APPROVED')
else:
  print('DENIED')
n = int(input())
a = list(map(int, input().split()))

for i in a:                    
    if i % 2 == 0:
        if i % 3 and i % 5:
            print('DENIED')
            break
else:
    print('APPROVE')
N = int(input())
num = list(map(int,input().split()))

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

ans = ""
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break
print(ans)
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
    elif i==n-1:
        print('APPROVED')
        break
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:
            continue
        else:
            print("DENIED")
            exit()

print("APPROVRD")
N=int(input())
z=[int(x) for x in input().split()]
y=[x for x in z if x//2==0]
a=[a for a in y if (a//3==0 or a//5==0)]
if len(y)==len(a):
    print('APPROVED')
else:
    print('DENIED')
n=int(input())
a=list(map(int,input().split()))
f=0
for i in range(n):
    if a[i]%2==0 and (a[i]%3==0 or a[i]%5==0):
        f=1
    elif a[i]%2==0:
        f=0
        break
if f==1:
    print("APPROVED")
else:
    print("DENIED")
x=int(input())
y=input()
z=y.split()
e=0
for i in z:
    w=int(i)%2
    if w%2 == 0:
        if w%5 == 0:
            continue
        elif w%3 ==0:
            continue
        else:
            e=1
        
if e == 1:
    print("DENIED")
else:
    print("APPROVED")
N = int(input())
data = list(input().split())
sw1 = 0
sw2 = 0
for i in range(0,len(data)):
    if int(data[i]) % 2 == 0:
        sw1 += 1
        if int(data[i]) % 3 == 0 or int(data[i]) % 5 == 0:
            sw2 += 1

print(sw1,sw2)
if sw1 > 0 and sw1 == sw2:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = [int(e) for e in input().split()]
flag = True
for i in range(0,n):
    if a[i] % 2 == 0 and (a[i] % 3 != 0 and a[i] % 5 != 0):
        flag = False
if flag:
    print("APPROVE")
else:
    print("DENIED")
l = input().split()
l = l[1:]

flag = "APPROVED"
for n in l:
  if n % 2 == 0 and n%3 != 0 and n%5 != 0:
    flag = "DENIED"
    
print(flag)
N=int(input())
c=list(map(int,input().split()))
flag=0
for i in range(N):

    if c[i]%2==0:
        if c[i]%3==0 or c[i]%5==0:
            flag=1
        else:
            print("DENIED")
            exit(0)

if flag==1:
    print("APPROVED")
N=int(input())
a = list(map(int,input().split()))
c=0
i=0
print(a)
while(c==0 and i<N):
    if(a[i]%2==0):
        if(a[i]%3==0 or a[i]%5==0):
            i+=1
        else:
            c+=1
    else:
        i+=1
if(c==0):
    print("APPROVED")
else:
    print("DENINED")
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:ans="DENIED"
print(ans)
n = int(input())
a = list(map(int,input().split()))
flag = 0

for i in a:
  if i % 2 == 0:
    if i % 3 == 0:
      flag = 1
      pass
    elif i % 5 == 0:
      flag = 1
      pass
    else:
      print('DENIED')
      flag = 0
      break
  else:
    flag = 0
    
if flag == 1:
  print('APPROVED')
else:
  print('DENIED')
n = int(input())
a = [int(i) for i in input().split()]
flag = True
for i in a:
    if i%3 != 0 and i%5 != 0:
        flag = False

print("APPROVED" if flag else "DENIED")
n = int(input())
a = list(map(int, input().split()))

for x in a:
  if x%2 == 0:
    if x%3 == 0 or x%5 == 0:
      print("APPROVED")
      break
    else:
      print("DENIED")
else:
  print("DENIED")
N=int(input())
A=list(map(int,input().split()))
print("APPROVED" if all(i%2==0 and (i%3==0 or i%5==0) for i in A) else "DENIED")
a=input()
b=list(map(int,input().split()))
c=0
for k in b:
  if k%2==0:
    if k%3==0 or k%5==0:
      c+=1
      continue
    else:
      print('DENIED')
  else:
    c+=1
if c==int(a):
  print('APPROVED')