peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines  

N = input()
A = list(map(int, input().split()))
A = [a for a in A if a%2 == 0]

for a in A:  
    if a % 3 != 0 and a % 5 != 0:
      print("DENIED")
      exit()
    
print("APPROVED" if len(A) != 0 else "DENIED")
num = int(input())
lst = list(map(int,input().split()))
count = 0
counta = 0
for i in range(num):
  if lst[i] % 2 == 0:
    count += 1
    if lst[i] % 3 == 0 or lst[i] % 5 == 0:
      counta += 1
if count == counta and count > 0:
  print("APPROVED")
else:
  print("DENIED")
n=input()
a=list(map(int,input().split()))
for i in a:
    if i%2!=0:
        continue
    elif i%2==0:
        if i%3!=0 and i%5!=0:
            print('DENIED')
            break
    else:
        continue
print('APPROVED')
data = list(map(int,input().split()))
sw1 = 0
sw2 = 0
for i in range(0,len(data)):
    if data[i] % 2 == 0:
        sw1 += 1
        if data[i] % 3 == 0 or data[i] % 5 == 0:
            sw2 += 1

print(sw1,sw2)
if sw1 >= 0 and sw1 == sw2:
    print("APPROVED")
else:
    print("DENIED")
X = [int(x) for x in input().split()]

N = X[0]
X = X[1:]

Y = [x for x in X if x%2 == 0]

Z = [y for y in Y if y%3 != 0 and y%5 != 0]

print(Z)

if len(Z) == 0:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = list(map(int,input().split()))
num = [i for i in A if i % 2 == 0]
for i in num:
    if i % 3 != 0 and i % 5 != 0:
        print('DENIED')
        break
print('APPROVED')
n = int(input())
A = list(map(int, input().split()))
print("APPROVED" if any(a%2==0 & a%3==0 | a%5==0 for a in A) else "DENIED")
n = int(input())
l = list(map(int, input().split()))
l2 = [i for i in l if i % 2 == 0]
l3 = [i for i in l2 if i % 3 == 0]
l4 = [i for i in l2 if i % 5 == 0]
l5 = list(set(l4+l3))
if len(l) == n:
    if len(l5) == len(l2):
        print('APPROVED')
    else:
        print('DENIED')
else:
    print('DENIED')
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 or A[i]%5 == 0:
      print('APPROVED')
      sys.exit()
print('DENIED')
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")

        else:
             print("APPROVED")
        exit()
print("DENIED")
n = int(input())
A = list(map(int, input().split()))

bad = 0
for i in range(n):
    if(A[i] % 2):
        if(A[i] % 3 != 0 or A[i] % 5 != 0):
            bad += 1

if(bad >= 1):
    print("DENIED")
else:
    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
    else:
      continue
  continue
  print('APPROVED')
n = int(input())
a = list(map(int,input().split()))

yoki = dame = 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

if dame >= 1:
    print("DENIED")
elif yoki >= 1:
    print("APPROVED")
n = int(input())
a = list(map(int,input().split()))
c = 0
b = 0
for i in range(len(a)):
  if i % 2 == 0:
    c += 1
  elif a[i] %2 == 0 and (a[i] % 3 != 0 or a[i] %5!= 0):
    b += 1
if c == b:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
list = input().split()
on = 0
for i in range(N):
  k = int(list[i])
  if k % 2 == 0:
    if k % 3 == 0 or k % 5 == 0:
      on = 1 
    else:
      print("DENIED")
      break
  if i == N-1:
    if on == 1:
  	   print("APPROVED")
    else:
 	   print("DENNIED")
n = int(input())
li = list(map(int,input().split()))
flag = False
for i in li:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      print("DENIED")
      flag = True
if not flag:
  print("APPROVED")
import sys
N = int(input())
p = 'DENIED'

for i in map(int, input().split()):
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      print('DENIED')
      sys.exit()
    elif i % 3 == 0 or i % 5 == 0:
      p = 'APPROVED'
print(p)
N=int(input())
list1=[]
list2=[]
for i in map(int,input().split()):
    if i % 2 == 0:
        list1.append(i)
    if i % 2 == 0 and i % 3 == 0:
        list2.append(i)
    if i % 2 == 0 and i % 5 ==0:
        list2.append(i)
if list1 == list2:
    print('APPROVED')
else:
    print('DENIED')
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
      break

    
if count!=0:
  print('DENIED')
else:
  print('APPROVED')
input()
m = input().split()
judge = ""
for i, e in enumerate(m):
    if int(e)%2 == 0:
        if int(e)%3==0 or int(e)%5==0:
            judge = "APPROVED"
        else:
            print(judge)
            break
print(judge)
n = input()
List = list(map(int,input().split()))
k=0
for s in List:
  if s%2==1 or s%3==0 or s%5==0:
    k+=1
if k==n:
  print("APPPROVED")
else:
  print("DENIED")
n =int(input())
w = list(map(int,input().split()))
print('APPROVED')
for i in range(n):
  if w[i]%2!=0:
    continue
  else:
    if w[i]%3==0 or w[i]%5==0:
      continue
    else:
      a='DENIED'
      break
N = input()
N = int(N)
A = list(map(int,input().split()))
B = [ i for i in A if i % 3 == 0 or i % 5 == 0]
C = [ d for d in B if  d % 2 == 0]
R = len(C)
if R == 0:
  print("DENIED")
else:
  print("APPROVED")
input1 = list(map(int, (input().split())))
input2 = list(map(int, (input().split())))

n = input1[0]

for a in input2:
    if(a & 1 == 1):
        print("DENIED")
        exit(0)

    if(a % 3 == 0 or a % 5 == 0):
        print("APPROVED")
        exit(0)

print("DENIED")
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"
    else:
      ans="APRROVED"
    
print(ans)
N = int(input())
list = input().split()
on = 0
for i in range(N):
  k = int(list[i])
  if k % 2 == 0:
    if k % 3 == 0 or k % 5 == 0:
      on = 1 
    else:
      print("DENIED")
      break
  if i == N-1:
    if on == 1:
  	   print("APPROVED")
    else:
 	   print("DENIED")
n=int(input())
a=list(map(int,input().split()))
ans="APPROVED"
for i in range (n):
  if a[i]%2==0:
    if a[i]%15!=0:
      ans="DENIED"
    
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 and A[i] % 5 != 0:
      print('DENIED')
      break
    elif i != N:
      continue
    else:
      print('APPROVED')
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=map(int,stdin[1].split())
flag=True
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:
        flag=False
        exit()
print('APPROVED' if flag else 'DENIED')
n=int(input())
a=list(map(int,input().split()))
ans="DENIED"

for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            ans="APPROVED"
        else:
            ans="DENIED"
            break
    else:
        continue
        
print(ans)
N = int(input())

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

even = 0
bai = 0
for i in range(N):
    if A[i] % 2 == 0:
        even = even + 1
        print(even)
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            bai = bai + 1
    i = i + 1
    
if even == bai:
    print("APPROVED")
else:
    print("DENIED")
n = input()
a = list(map(int,input().split()))
ans = 'APPROVED'
 
for i in a:
  if i % 2 == 0:
    if i % 3 != 0:
      ans = 'DENIED'
      break
    elif i % 5 != 0:
      ans = 'DENIED'
      break
 
 
print(ans)
n = int(input())
list = [int(x) for x in input().split(" ")]
result = 'DENIED'
for i in range(len(list)):
    if list[i]%2 == 0:
        if list[i]%3==0 or list[i]%5==0:
            result = 'APPROVED'
        else:
            result = 'DENIED'
            break
print(result)
N = int(input())
A_list = list(map(int, input().split()))
isDenied = False
for num in A_list:
    if num %2 == 0:
        if not (num%3 == 0 or num%5 == 0):
            print('DENIED')
            isDenied = True

if not isDenied:
    print('APPROVED')
import numpy as np

N = int(input())
A = [int(i) for i in input().split()]
 
flag = True
for a in A:
  if a%2 == 0:
    if a%3 != 0 or a%5 != 0:
      flag = False

if flag:
  print('APPROVED')
else:
  print('DENIED')
a = int(input())
n = [int(x) for x in input().split()]
b = []
f = 0
for i in range(a):
  if n[i] % 2 == 0:
    b.append(n[i])
for i in b:
  if i % 3 != 0:
    if i % 5 != 0:
      continue
    else:
      f = 1
if f:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
numbers = input().split()
for i in range(n):
    n = int(numbers[i])
    if n % 3 != 0 and n % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')
n=int(input())
A=list(map(int,input().split()))

for i in range(n):
    if A[i]%6==0 or A[i]%10==0:
        print("APPROVED")
    else:
        print("DENIED")
n=int(input())
l=list(map(int, input().split()))
br=0
for i in range (n):
    if l[i]%2==0 and l[i]%5==0 or l[i]%3==0:
        br+=1
if br==n:
    print("APPROVED")
else:
    print("DENITED")
n = int(input())
a = list(map(int, input().split()))
b=0
x=0
for i in range(n):
  if a[i]%2==0:
    x+=1
    if a[i]%3==0 or a[i]%5==0:
      b+=1
print('APPROVED' if b==x else 'DENNIED')
N = int(input())
A = list(map(int, input().split()))
judge = 0
for i in range(N):
    if A[i] % 2 == 1:
        continue
    elif A[i]%3 == 0 or A[i]%5 == 0:
        judge += 0
    else:
        judge += 1
print('APPROVED' if judge == 0 else 'DENITED')
N=int(input())
A=list(map(int,input().split()))
def linersearch(N,A):
    for i in range(N):
        if A[i]%3==0 or A[i]%5==0:
            return "APPROVED"
        else:
            return "DENIED"
linersearch(N,A)
N = int(input())
lists = list(map(int, input().split()))

a = []
for i in lists:
    if i % 2 == 0:
        a.append(i)
        count = 0
        if i % 3 == 0:
            break

        elif i % 5 == 0:
            break

        else:
            print("DENIED")
            exit()

print("APPROVED")
n = int(input())
a_list = list(map(int, input().split()))

a_list_even = [i for i in a_list if i % 2 == 0]
print(a_list_even)
for a in a_list_even:
    if a % 3 == 0 or a % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()

print("APPROVED")
document = 25
if document % 2 == 0:
	if document % 3 == 0 or document % 5 == 0:
		print('approved')
	else:
		print('denied')
else:
	print('denied')
N = int(input())
A = list(map(int, input().split()))
ans = True
for i in A:
    if i%2 == 0 and (i%3 == 0 or i%5 == 0):
        continue
    else:
        ans = False
print("APPROVED" if ans==True else "DENIED")
n=int(input())
a=list(map(int,input().split()))

ans="DENIED"
if 1<=n<=100 and 1<=min(a) and max(a)<=1000:
    for i in range(n-1):
        if a[i]%6==0 or a[i]%10==0:
            pass
        elif a[i]%2==1:
            pass
        else:
            break
    else:
        ans="APPROVED"

print(ans)
_=input()
a=list(map(int,input().split()))
on=True
for i in a:
  if i%2==0 and i % 3 != 0 and i % 5 != 0:
			on=False
			exit()
print("APPROVED" if on else "DENIED")
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 = 1
      
if F == 1:
  print('DENIED')
else:
  print('APPROVED')
_=int(input())
a=list(map(int,input().split()))
bool=True
for i in a:
  if i%2==0:
    if i%3==0 or i%5==0:
      bool=False
if bool:
  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:
          x += 1
N = int(input())
A_list = list(map(int, input().split()))
isDenied = False
for num in A_list:
    if num%2 == 0 and num%3 != 0 and num%5 != 0:
        print('DENIED')
        isDenied = True
 
if not isDenied:
    print('APPROVED')
import sys

def result():


    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 and num%3!=0 or num %5 != 0:
            print('DENIED')
            return 

    print('APPROVED')



result()
input()
o = True
for i in map(int, input().split()):
  if i % 2 == 0:
  	if i % 3 == 1 and i % 5 == 1:
  		o = False

if o is True:
  print("APPROVED")
else:
  print("DENIED")
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i%2!=0 and (i%3!=0 or i%5!=0):
    print("DENIED")
    exit()
print("APPROVED")
n =int(input())
a = map(int, input().split())
t = False
for i in a:
    if i%3 ==0 or i%5 == 0:
        print("APPROVED")
    else:
        print("DENIED")
import sys
arr = list(map(int, input().split()))
c=False
for i in arr:
	if(i%2==0):
		c=True
		if(i%3==0 or i%5==0 ):
			print("APPROVED")	
		else:
			print("DENIED")	
if(c!=True):
	print("DENIED")
N=int(input())
A=list(map(int,input().split()))
X=[]
count = 0
for i in range(N):
  if A[i]%2==0 and A[i]%3!=0  or A[i]%5!=0:
    count+=1
if count > 0:
  print("DENIED")
else:
  print("APPROVED")
vals = input().split(" ")
vals = map(int, vals)

bol = True

for val in vals :
	if val % 2 == 0 :
	  if not (val % 3 == 0 or val % 5 == 0) :
	    bol = False

if bol :
  print("APPLOVE")
else : 
  print("DENIED")
n = int(input())
a = list(map(int,input().split()))
ans = 'DENIED'
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            ans = 'APPROVED'
        else:
            break
    else:
        ans = 'APPROVED'
print(ans)
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines  

N = input()
A = list(map(int, input().split()))
A = [a for a in A if a%2 == 0]

if len(A) == 0:
  print("DENIED")
  exit()
ans = 0
for a in A:  
    if a % 3 == 0 or a % 5 == 0:
      ans += 1
    
print("APPROVED" if len(A) == ans else "DENIED")
N = int(input())
integers = list(map(int,input().split()))
gusus=[]

approved = True

for i in integers[0:N]:
    if i%2==0:
        gusus.append(i)

for i in gusus:
    if i%3==0 and (not i%15==0):
        pass
    elif i%5==0 and (not i%15==0):
        pass
    else:
        approved=False
        break

if len(gusus)==0:
    approved=False

if approved==True:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = list(map(int,input().split()))
b = []
for i in range(n):
    if a[i] %2 == 0:
        b.append(a[i])

d = len(b)
if d == 0:
    print('APPROVED')

bool == True
for c in b:
    if (c %3 != 0) and (c %5 != 0):
        bool = False
        break
    else:
        bool = True

if bool == True:
    print('APPROVED' )
else:
    print('DENIED')
N = list(map(int, input().split()))
A = list(map(int, input().split()))

isApprove = False

for x in A:
    if x % 2 == 0:
        if (x % 3 == 0) or (x % 5 == 0):
            isApprove = True
        else:
            isApprove = False
            break
    else:
        isApprove = False

if isApprove:
    print ('APPROVED')
else:
    print('DENIED')
N = int(input())
A = [int(x) for x in input().split()]



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

for i in A :
    if i % 2 == 0:
        validation =  check(i)
        B.append(validation)

for i in B:
    if i == False:
       C = False
       break
    else:
       C = True


if C:
    print("APPROVED")
else:
    print("DENIED")
import sys
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')
            print(a[i])
            sys.exit()
print('APPROVED')
n = int(input())
items = [int(x) for x in input().split()]

flg = False
for item in items:
  if item % 2 == 0:
    if item % 3 == 0 or item % 5 == 0:
      flg = True
    else:
      flg = False
      break

if flg:
  print('APPROVED')
else:
  print('DENIED')
N = int(input())
FLG=1

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

for i in range(N):
  if n[i]/2 == 0:
    if n[i]/3 != 0:
      FLG=0
    elif n[i]/5 != 0:
      FLG=0
   
if FLG == 0:
  ans = "DENIED"
else:
  ans = "APPROVED"

print(ans)
X = [int(x) for x in input().split()]

N = X[0]
X = X[1:]

Y = [x for x in X if x%2 == 0]

Y1 = [x for x in Y if x%3 == 0]
Y2 = [x for x in Y if x%5 == 0]

if set(Y) == set(Y1)|set(Y2):
    print("APPROVED")
else:
    print("DENIED")
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()))
for i in a:
  if i%2!=0 and (i%3!=0 and i%5!=0):
    print("DENIED")
    exit()
print("APPROVED")
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:
        empty.append(i)
    if i%5==0:
        empty.append(i)
print('APPROVED' if len(empty)==len(a2) else 'DENIED')
n=int(input())
a=list(map(int, input().split())) 

box=[]
for i in range(n):
    if a[i]%2==0:
        box.append(a[i])
    
for i in range(len(box)):
    if box[i]%3==0 or box[i]%5==0:
        if i == len(box)-1:
            print('APPROVED')
    else:
        print('DENIED')
        break
import sys
N = int(input())
p = 'DENIED'

for i in map(int, input().split()):
  #a = int(input())
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      p = 'DENIED'
      sys.exit()
    else:
      p = 'APPROVED'
      continue
  else:
    continue
print(p)
# -*- coding: utf-8 -*-
n = input() # 2 ~ 99
an = [int(x.strip()) for x in input().split(' ')]

count = 0
for i in an:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      count += 1
      break
if count >= 1:
  print('APPROVED')
else:
  print('DENIED')
N=int(input())
A=list(map(int,input().split()))
B=0
C=0
for i in range(N):
    if A[i]%2==0:
        B+=1
        if A[i]%2==0 and (A[i]%3==0 or A[i]%5==0):
            C+=1
if B==C:
    print('APPRPVED')
else:
    print('DENIED')
n = int(input())
li = list(map(int,input().split()))
flag = 0
for i in range(n):
    if((li[i] % 2 == 0) and (li[i] != 0)):
        if((li[i] % 3 == 0) or(li[i] % 5 == 0)):
            #print(li[i])
            flag=1
        else:
            #print(li[i])
            flag=0
            break


if(flag == 1):
    print('APPROVED')
else:
    print('DENIED')
from sys import exit

N = int(input())
A = tuple(map(int, input().split()))
for a in A:
    if not a % 2 and a % 3 and a % 5:
        print('DENIED')
        exit()
print('ACCEPTED')
n = int(input())
a = list(map(int, input().split()))

lst_0 = [e for e in a if e % 2 == 0]
lst_1 = [e for e in lst_0 if e % 3 == 0]
lst_2 = [e for e in lst_0 if e % 5 == 0]
lst_3 = lst_1 + lst_2

if lst_3 == lst_0:
    print('APPROVED')
else:
    print('DENIED')
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

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

if __name__ == '__main__':
    import sys;
    try:
        main(sys.argv)
    except TypeError:
        main()
n = int(input())
a = list(map(int, input().split()))

flag = 0
for x in a:
  if x%2==0 and (x%3 and x%5):
    flag = 1
if flag:
  print("DEBIED")
else :
  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
        else:
            print('DENIED')
            break
if count == check:
	print('APROVED')
length = int(input())
li = list(map(int,input().split()))

judge = True

for i in range(length):
  a = li[i]
  if a % 2 == 0:
      if a % 3 != 0 or a % 5 != 0:
          judge = False
          break;
  
if judge:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
A = list(map(int, input().split()))
cnt = 0
for i in range(N-1):
    if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
        cnt +=1
if cnt==0:
    print('APPROVED')
else:
    print('DENIED')
n = input()
list_a = list(map(int, input().split()))

for a in list_a:
  if a%2 == 0:
      if a%3 == 0:
          if a%5 == 0:
            continue
          else:
            exit()
      else:
        print("DENIED")
        exit()
    
print("APPROVED")
n = int(input())
a = list(map(int,input().split()))
ans = 'DENIED'
for x in a:
    if x % 2 == 0 and x % 3 == 0 or x % 5 == 0 :
        ans = 'APPROVED'
print(ans)
n = input()
list = input().split(" ")
for number in list:
  int_number = int(number)
  if (int_number % 2) == 0:
    if int_number %3 != 0:
      if int_number %5 != 0:
      	print("DENIED")
      	exit()
print("ACCEPTED")
# Papers, Please

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

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

print("AOOROVED")
N = int(input())
A = list(map(int,input().split()))
ans = "APPROVED"
for i in range(len(A)):
    flag = 1
    if A[i]%2 == 0:
        if A[i]%3 != 0:
            flag = flag - 1
        if A[i]%5 != 0:
            flag = flag - 1  
        if flag < 0: 
            ans = "DENIED"
        print(flag)
print(ans)
N = int(input())
A = list(map(int,input().split()))
li = []
ans = "APPROVED"

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

for i in li:
  if i % 5 == 0 or i % 3 == 0:
    ans = "APPROVED"
  else:
    ans = "DENIED"
    break
import math


def readints():
    return list(map(int, input().split()))


n = int(input())
a = readints()

for j in range(n):
    if a[j] % 2 != 0:
        exit()

for i in range(n):
    if a[i] % 2 == 0:
        # print(a[i])
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            print("APPROVED")
            exit()
        else:
            print("DENIED")
            exit()
N = int(input())
A = list(map(int,input().split()))

count = 0

for i in range(N):
    if A[i]%2 == 0:
        count += 1
        continue
        
    if A[i] % 3 or A[i] % 5:
        count += 1
        continue
            
if count == N:
    print('APPROVED')
else:
    print('DENIED')
n = int(input())
l = list(map(int, input().split()))
cnt = 0
for i in range(n):
    if l[i] % 2 == 0:
        if l[i] % 3 == 0:
          cnt += 1
        elif l[i] % 5 == 0:
          cnt += 1
    else:
        print("DENIED")
        quit()
print("APPROVED")
N = int(input())
oddNum = set()

for x in list(map(int, input().split())):
    if (x % 2 == 0):
        oddNum.add(x)

if (len(oddNum) == 0):
    print("DENIED")

for o in range(len(oddNum)):
    if ((o % 3 != 0) | (o % 5 != 0)):
        print("DENIED")
        exit()

print("APPROVED")
# -*- coding: utf-8 -*-
a = int(input())
lis = list(map(int, input().split()))
for i in range(a):
  judge = True
  if (lis[i] % 2 == 0):
    if (lis[i] % 3 != 0) and (lis[i] % 5 != 0):
      judge = False
# 出力
if judge:
  print("APPROVED")
else:
  print("DENIED")
n = input()
X = set(map(int, input().split()))
E = [x for x in X if x % 2 == 0]
EE = [e for e in E if (e % 3 == 0 or e % 5 == 0)]
if len(E) == len(EE):
    print("APPLOVED")
else:
    print("DENIED")
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0:
    if i % 3 != 3 or i % 5 != 5:
    	is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")
N=int(input())
li=list(map(int,input().split()))
li2=[]
x=0

for n in range(N):
  if li[n]%2 == 0:
    if ((li[n]%3 == 0) or (li[n]%5== 0)):
      li[n]="ok"
    else:
      li[n]=1
    li2.append(li[n])
  else:
    pass
  x=x+1
   
if li2.count("ok")==x:
  print("APPROVED")
else:
  print("DENIED")
from sys import exit

N = int(input())
A = tuple(map(int, input().split()))
for a in A:
    if a % 2 == 0:
        if not(a % 3 != 0 or a % 5 != 0):
            print('DENIED')
            exit()
print('APPROVED')