peterverebics/CodeNet_Python_118 huggingface dataset:
n = int(input())
a = list(map(int, input().split()))
flag = False
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            flag = True
        else:
            flag = False
            break

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

if flag==1:
    print("APPROVED")
else:
    print("DENIED")
time=int(input())
nums=[int(i) for i in input().split()]
odd=0
even=0
even35=0
for j in range(time):
    if nums[j]%2==0:
        even+=1
        if nums[j]%3!=0 and nums[j]%5!=0:
            continue
        else:
            even35+=1
    else:
        odd+=1
        
if even35==even==0:
    print("DENIED")
elif even35==even:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = map(int,input().split())
flag = True
for i in a:
  if i % 2 == 0 and (i % 3 != 0 or 1 % 5 != 0):
    flag = False
print("APPROVED" if flag else "DENIED")
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:
            flag=False
        elif A[i]%5!=0:
            flag=False
if flag==True:
    print('APPROVED')
else:
    print('DENIED')
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:
            ans = False
    else:
        ans = False
if ans==True:
    print("APPROVED")
else:
    print("DENIED")
input()
a = [int(x) for x in input().split()]
    
for i in a:
  B = i%2
  if B==0:
    print(i)
    if i%3 == i%5 and i>=6:
      print("APPROVED")
    else:
      print("DENIED")
  else:
    print("DENIED")
n = int(input())
z = list(map(int, input().split()))
print('APPROVED' if (a & 1 or i % 3 == 0 or i % 5 == 0 for i in z) else 'DENIED')
import sys
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:
            pass
          else:
            print("DENIED")
            sys.exit()
      else:
        print("DENIED")
        sys.exit()
    
print("APPROVED")
N=int(input())
A=list(map(int,input().split()))
X=[]
count = 0
for i in range(N):
  if A[i]%2==0:
    if A[i]%3==0 or A[i]%5==0:
      count+=1
if count > 0:
  print("DENIED")
else:
  print("APPROVED")
N = int(input())
A = list(map(int, input().split()))

flag = False
for i in range(N):
    if A[i] % 2 == 0:
        if (A[i] % 3 == 0) or (A[i] % 5 == 0):
            flag = True
        else:
            flag = False
            break

if flag == True:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = list(map(int, input().split()))
b = ""
for i in a:
  if i % 2 == 0:
    if (i % 3 == 0 or i % 5 == 0):
      b = "APPROVED"
    else:
      b = "DENIED"
      break
print(b)
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    def judge():
        for x in A:
            if x % 2 == 0:
                if x % 3 != 0 or x % 5 != 0:
                    return False
        return True

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


if __name__ == '__main__':
    main()
n = int(input())
a = [int(x) for x in input().split()]

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

ans = "APPROVED"
for a_eveni in a_even:
    if a_eveni%3 != 0 or a_eveni%5 != 0:
        ans = "DENIED"
        break

print(ans)
n =int(input())
a = map(int, input().split())
t = False
for i in a:
    if i%3 ==0 or i%5 == 0:
        t = True
    else:
        t = False
if t:
    print("APPROVED")
else:
    print("DENIED")
n = 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:
            judge = "DENIED"
            break
print(judge)
N = int(input())
a_list = [int(x) for x in input().split(' ')]
a_list = list(filter(lambda x:x%2 == 0 and (x%3 != 0 and x%5 != 0), a_list))
print(a_list)

if not a_list:
    print('APPROVED')
else:
    print('DENIED')
_,a=open(0);print('ADPEPNRIOEVDE D'[any(a%3*a%5&~a for a in map(int,a.split()))::2])
import math


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


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


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())
li = list(map(int,input().split()))
flag = False
for i in li:
  if i % 6 == 0 or i % 10 == 0:
    continue
  else:
    print("DENIED")
    flag = True
if not flag:
  print("APPROVED")
N = input()
raw_input1 = input()

l = raw_input1.split()
l_num = [int(x) for x in l]

flag = 0
flag1 = 0

for a in l_num:
    if a % 2 ==0:
        if a % 3 == 0 or a % 5 == 0:
            flag = 0
        else:
            flag = 1
    if flag != 0:
        break

if flag == 0:
    print('APPROVAL')
else:
    print('DENIED')
N = int(input())

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

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

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

l = [i for i in a if i%2 == 0]
tmp = [i for i in a if i%2 == 0]

while l:
    e = l.pop()
    if e % 2 == 0:
        tmp.append(e)

while tmp:
    l.append(tmp.pop())

while tmp:
    e = tmp.pop()
    if e % 3 == 0:
        l.append(e)

while l:
    tmp.append(l.pop())

while tmp:
    e = tmp.pop()
    if e % 5 == 0:
        l.append(e)

while l:
    tmp.append(l.pop())


if tmp != l:
    print('APPROVED')
else:
    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())
ai = list(map(int,input().split()))

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

count = 0

for i in A:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
            count += 1
        else:
            count += 0
    else:
        count += 1


if int(count) == N:
    print("APROVED")
else:
    print("DENIED")
import sys
n = int(sys.stdin.readline().rstrip())
li = list(map(int, sys.stdin.readline().split()))
li2 = []
for i in li:
  if not i % 2:
    li2.append(i)
if not len(li2):
  flag = True
else:
  flag = False
for i in li2:
  if not i % 3 and not i % 5:
    flag = False
    break
print('APPROVED' if flag else 'DENIED')
N = int(input())
A = list(map(int,input().split()))

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

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

s = "APPRPVED"

for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            s = "DENIED"

print(s)
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if not i%2==0 and (i%3==0 or i%5==0):
    print("DENIED")
    exit()
print("APPROVED")
'''input
3
28 27 24
'''
n = input()
a = map(int, input().split())

ok = 0
for i in a:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			ok = 0

if ok == 1:
	print("APPROVED")
else:
	print("DENIED")
n = int(input())
arr = [int(s) for s in input().split(" ")]


def calculate(n,arr):

    for ar in arr:
        if ar % 2 == 0:
            s1 = ar % 3
            s2 = ar % 5
            if (s1 == 0) or (s2 == 0):
                print("APPROVED")
                return
            else:
                print("DENIED")
                return

    print("DENIED")

calculate(n,arr)
N = int(input())
A = input().split()
A = [int(i) for i in A]
t = 0
for i in range(N-1):
  if A[i] % 2 == 0:
    if A[i]%3 !=0 and A[i]%5 != 0:
      t += 1
if t == 0:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
a = list((int(x) for x in input().split()))
for num in a:
  if num%2 == 0:
    if not num%3 == 0 and num%5 == 0:
      print('DENIED')
      exit()
print('APPROVED')
n=int(input())
l=list(map(int,input().split()))
for i in range(n):
  if l[i]%2==0:
    if l[i]%3!=0 and l[i]%5!=0:
      print('DENIED')
      break
  elif i==n-1:
    print('APPROVED')
import collections
elems = map(int, raw_input().split(' '))

def f(elems):
	for e in elems:
		if e % 2 == 0:
			if not((e % 3 == 0) or (e % 5 == 0)):
				return False
	return True

print 'Approved'.upper() if f(elems) else 'Denied'.upper()
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("DENIED")
      exit()
print("APPROVED")
a = list(map(int,input().split()))

b,c = 0,0
for i in a:
    if (i%2)==0:
        b += 1
        if(i%3 == 0) or (i%5 == 0):
            c += 1

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

result="APPROVED"
for i in range(N):
    if A[i]%2==0:
        guu.append(A[i])
for i in range(len(guu)):
    if (guu[i]%3!=0)and(A[i]%5!=0):
            result="DENIED"
            break

print(result)
x = input()
y = input()
list = y.split()
even_list = []
result = ''

for i in list:
  i = int(i)
  if i % 2 == 0:
    even_list.append(i)
  else:
    result = "DENIED"
    
for y in even_list:
  if y % 3 == 0 or y % 5 == 0:
    result = "APPROVED"
  else:
    result = "DENIED"
    break
    
print(result)
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 or a[i] % 5 == 0:
            flag = 0
        else:
            flag = 1
            break

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

for x in arr:
    if ((x % 2) == 0) and not (x % 3 + x % 5):
        print("DENIED")
        break
else:
    print("APPROVED")
n = int(input())
A = list(map(int, input().split()))
count = 0
for a in A:
    if a%2==0:
        if a%3==0 or a%5==0:
            print('APPROVED')
            break
        else:
            print('DENIED')
            break
    else:
        count+=1

if count == len(A):
    print('DENIED')
n = int(input())
a_list = list(map(int, input().split()))
flag = "ok"
for i in a_list:
  if i%2 == 0: 
    if i%3 != 0 or i%5 != 0:
      flag = "ng"
if flag == "ok":
  print("APPROVED") 
else:
  print("DENIED")
N = int(input())
A = list(map(int,input().split()))

count = 0
odd = 0
flag = 0

for n in A:
    if (n % 2) == 0:
        count += 1
        #print(n)
        if (n % 3) == 0 or (n % 5) == 0:
            odd += 1
        else:
            print("DENIED")
            exit()

if count == 0:
    print("DENIED")
elif count == odd:
    print("APPROVED")
else:
    print("DENIED")
import sys
n = int(input())
a = list(map(int, input().split()))

p = 'DENIED'
for i in a:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      p = 'APPROVED'
    else:
      print('DENIED')
      sys.exit()
print(p)
n = int(input())
a_list = list(map(int, input().split()))

ans = 'APPRONED'
for i in range(0, n) :
  if a_list[i]%2 == 0 :
    if (a_list[i]%3)*(a_list[i]%5) != 0 :
      ans = 'DENIED'
      break
print(ans)
j = int(input())
i = list(map(int, input().split()))
l=0
for k in range(j):
    if i[k-1]%2==0:
        if i[k-1]%3!=0 and i[k-1]%5!=0:
            print('DENIED')
            l=1
if l == 0:
    print('APPROVED')
N = int(input())
X = list(map(int,input().split()))

i = 0
a = 0
b = 0
y = 0

for i in range(N):
  if X[i] % 2 == 0:  
    a = a + 1
    if X[i] % 3 == 0 or X[i] % 5 == 0:
      y = y + 1
    else:
      print("DENIED")
      break
  else:
    b = b + 1

if b == 0 and N == y:
  print("APPROVED")
n, s, f = int(input()), list(map(int, input().split())), True
for e in s:
  if not e & 1:
    if e % 3 != 0 or e % 5 != 0: f = False; break
print('APPROVED' if f else 'DENIED')
N=int(input())
flag=True
nums=list(map(int, input().split()))
for x in nums:
  if x%2:
    continue
  else:
    if x%3==0 and x%5==0:
      continue
    else:
      flag=False
      break
if flag:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
a = list(map(int, input().split()))

test = True
for i in a:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      test = False
      break
if test:
  print('APPROVAL')
else:
  print('DENIED')
# -*- codong:utf-8 -*-
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 or A[i]%5==0:
            ans=1
if ans==1:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = list(map(int, input().split()))
flag = True
for i in range(N-1):
    if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
        flag = False
if flag:
    print('APPROVED')
else:
    print('DENIED')
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
  if(i==N-1):
    print('APPROVED')
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")
    else:
      print("DENIED")
      break
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]%3==0 or A[i]%5==0:
            C+=1
if B==C:
    print('APPRPVED')
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:
            print("APPROVED")
        elif n[ni] % 5 == 0:
            print("APPROVED")
        else:
            print("DENIED")
    else:
        print("DENIED")
a = input()
num = [int(x) for x in input().split()]
flag = True
for x in num:
  if x % 2 == 0:
    if x % 3 != 0 and x % 5 != 0:
      flag = False
if flag:
  print('APPROVE')
else:
  print('DENIED')
N = int(input())
oddNum = set()

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

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

print("APPROVED")
a = input()
num = [int(x) for x in input().split()]
print(num)
flag = True
for x in num:
  if x % 2 == 0:
    if x % 3 != 0 and x % 5 != 0:
      flag = False
if flag:
  print('APPROVED')
else:
  print('DENIED')
import numpy as np
N = input()
list = list(map(int,input().split(' ')))

list = np.array(list)
A = list[list%2 == 0]
B = np.unique(np.append(list[list%6 == 0],(list[list%10 == 0])))

if len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')
none = input()
a = input().split()
a = list(map(int,a))
final = []
string = ""
for i in a:
   if i % 2 == 0:
      final.append(i)
for i in final:
   if i % 3 == 0 or i % 5 == 0:
      string = "APPROVED"
   else:
      string = "DENIED"
      break
print(string)
n = int(input())
a = list(map(int, input().split()))
ans = [True] * n
for i in range(n):
    if a[i]%2==0:
         a[i]%3!=0 and a[i]%5!=0
         ans[i] = False
if all(ans):
    print('APPROVED')
else:
    print('DENIED')
import sys
n = int(sys.stdin.readline().rstrip())
li = list(map(int, sys.stdin.readline().split()))
li2 = []
for i in li:
  if not i % 2:
    li2.append(i)
flag = True
for i in li2:
  if not i % 3 and not i % 5:
    flag = False
    break
print('APPROVED' if flag else 'DENIED')
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]%3!=0:
            x=1
            break
if x==1:
    print('DENIED')
else:
    print('APPROVED')
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
if flag == 1:
    if count == N:
        print('APPROVED')
        flag = 2
if flag == 0:
    print('DENIED')
n = int(input())

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

Alist = [x for x in A if x%2==0]

ans = False
for x in Alist:
    if x%3==0 or x%5==0:
        ans = True
    else:
        break
if ans == True:    
    print("APPROVED") 
else:
    print("DENIED")
N=int(input())
A=list(map(int,input().split()))
lis=[]
flag=1

for i in A:
  if i%2==0:
    lis.append(i)
    
for j in lis:
  if j%3!=0 and j%5!=0:
    flag=0
print("DENIED"if flag==0 else "APPROVE")
n = int(input())
list = [int(x) for x in input().split(" ")]
result = 'DENIED'
for i in range(len(list)):
    if list[i]%2 != 0:continue
    if list[i]%3!=0 and list[i]%5!=0:
        break
    else:
        result = 'APPROVED'
print(result)
N = input()
numList = input().split(' ')
print(numList)
for num in numList:
  num = int(num)
  if num % 2 == 0:
    judge1 = num % 3 == 0
    judge2 = num % 5 == 0
    approve = judge1 or judge2
    if not approve:
      print('DENIED')
      exit()
print('APPROVED')
def main():
    N = int(input())
    A = list(map(int,input().split()))
    i = 0
    s = ""
    while i < N:
        if A[i] % 2 == 0:
            if (A[i] % 3) == 0 or (A[i] % 5) == 0:
                continue
            else:
                print("DENIED")
        i += 1
    print("APPROVED")
main()
N = int(input())
L = list(map(int, input().split()))
count = 0
for i in range(0, N):
  if L[i]%2==0:
    if L[i]%3==0 or L[i]%5==0:
      print("APPROVED")
      count = 1
    else:
      count = 0

if count == 0:
  print("DENIED")
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:
            ans = True
        elif n[ni] % 5 == 0:
            ans = True 
        else:
            ans = False
    else:
        ans = False
if ans==True:
    print("APPROVED")
else:
    print("DENIED")
length = int(input())
li = list(map(int,input().split()))

judge = True

for i in range(length):
  a = li[i]
  if a % 2 == 0:
      if not 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()))
b = []
for i in a:
  if i%2==0:
    b.append(i)
c = 0
for i in b:
  if i%3!=0 in b or i%5!=0 in b:
    c = c+1
  else:
    pass
if c==0:
  print("APPROVED")
else:
  print("DENIED")
n=int(input())
a=list(map(int,input().split()))
a=[i for i in a if i%2==0]
for i in a:
  if i%3==0 or i%5==0:
    continue
  else:
    print("DENIED")
    break
  print("APPROVED")
n=int(input())
a=[int(s) for s in input().split()]
b=0
for i in range(n):
  if a[i]%2==0:
    if a[i]%3!=0 or a[i]%5!=0:
      b+=1
if b==0:
  print("APPROVED")
else:
  print("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(l5) == len(l2):
    if len(l2) != 0:
        print('APPROVED')
else:
    print('DENIED')
N=int(input())
A=list(map(int,input().split()))
if any(i%2==0 and i%3!=0 and i%5!=0 for i in A):
    print('DENINED')
else:
    print('APPROVED')
N = int(input())
A = list(map(int, input().split()))

ans = "DENIED"
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())
data = input().split()
 
ans = "APPROVED"
 
for i in range(n):
  num = int(data[i])
  if not(num % 6 == 0 or num % 10 == 0):
    ans = "DENIED"
    break
 
print(ans)
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 1%5!=0:
        print('DENIED')
        break
else:
    print('APPROVED')
def main():
	n=int(input())
	a=list(map(int, input().split()))
	count=0
	for i in range(n-1):
		if a[i]%2==0:
			if a[i]%3==0 or a[i]%5==0:
				count = count
			else:
				count +=1
			
	if count>0:
		print('DENIED')
	else:
		print('APPROVED')
main()
n = int(input())
a = list(map(int, input().split()))

del a[n:]

new1 = [i for i in range(len(a)) if a[i] % 2 == 0]
new2 = [i for i in range(len(new1)) if (new1[i] % 3 == 0 or new1[i] % 5 == 0)]

if len(new1) == len(new2):
  print("APPROVED")
else:
  print("DENIED")
N=int(input())
A=list(map(int,input().split()))
B=[i for i in A if i%2==0]
C=[i for i in B if i%3==0]
D=[i for i in B if i%5==0]
if len(B)==len(C)+len(D):
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
A = list(map(int,input().split()))
ans = 0
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      ans = 1
      break
      
if ans == 1:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
A = []
A = input().split()
ans = 0

for i in range(N-1):
    if(int(A[i])%2 == 0):
        if(int(A[i])%3 == 0 or int(A[i])%5 == 0):
            ans = 1
        else:
            ans = -1
    else:
        continue

if(ans == 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
    
if check:
    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

if isApprove:
    print ('APPROVED')
else:
    print('DENIED')
n = int(input())
a = list(map(int, input().split()))

evens = []
evens_count = 0
approved = "DENIED"
out_frag = 0

for i in range(n):
    if a[i] % 2 == 0:
        evens.append(a[i])
        evens_count += 1

if evens_count != 0:
    for j in range(evens_count):
        if not((evens[j] % 3 == 0) or (evens[j] % 5 == 0)):
            out_frag = 1
    if out_frag == 0:
        approved = "APPROVED"

print(approved)
import numpy as np
import sys

n = int(input())
aList = input().split(" ")

aList = np.array(aList, dtype=np.int)
aList = aList[aList % 2 == 0]

if len(aList) == 0:
    print("APPROVED")
    sys.exit(0)

a = list(aList[aList % 5 == 0])
b = list(aList[aList % 3 == 0])

if len(aList) == len(set(a + b)):
    print("APPROVED")
else:
    print("DENIED")
import sys
N = int(input())
A = [int(X) for X in input().split()]
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 5 == 0 or A[i]  % 3 ==0:
            print("APPROVED")
print("DENIED")
# -*- coding: utf-8 -*-
"""
Created on Tue Mar  3 23:44:02 2020

@author: Kanaru Sato
"""

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

deny = 0

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

if deny == 1:
    print("DENIED")
else:
    print("APRROVED")
n=int(input())
l=list(map(int, input().split()))
br=0
p=0
for i in range (n):
    if l[i]%2==0:
        p+=1
        if l[i]%5==0 or l[i]%3==0:
            br+=1
   
if br==p:
    print("APPROVED")
else:
    print("DENITED")
lis = list(map(int,input().split()))
x = 0
for i in lis:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            x = 1
if x == 0:
    print("APPROVED")
else:
    print("DENIED")