peterverebics/CodeNet_Python_118 huggingface dataset:
import sys


n = int(input())

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

for a in a_list:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            print('DENIED')
            sys.exit(0)

print('APPROVED')
n = int(input())
a = list(map(int,input().split()))
tf = True
for i in a:
    if i%2 ==0:
        if i % 3 ==0:
            pass
        elif i % 5 == 0:
            pass
        else:
            tf = False
if tf:
    print('APPROVED')
else:
    print('DENIED')
num = int(input())
num_list = [int(x) for x in input().split()]
cnt = 0
for i in range(num):
    if num_list[i] % 2 == 0:
        if not (num_list[i] % 3 == 0 or num_list[i] % 5 == 0):
            cnt += 1
            
if cnt != 0:
    print("DENIED")
else:
    print("APPROVED")
N = int(input())
a = list(map(int, input().split()))

for a_n in a:
    if a_n % 2 == 0:
        if a_n % 3 == 0 or a_n % 5 == 0:
            continue
        else:
            print('DENIED')
            break
else:
    print('APPROVED')
N = int(input())
A = list(map(int, input().split()))

for a in A:
  if a%2 == 0 and not (a%3 == 0 or a%5 == 0):
    print('DENIED')
    break
else:
  print('APPROVED')
#B
N = int(input())
A = list(map(int, input().split()))
ans = "APPROVED"

for item in A:
    if item % 2 == 0:
        if item % 3 == 0 or item % 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==1:
        pass
    else:
        if a[i]%3 !=0 and a[i]%5 !=0:
            print('DENIED')
            exit(0)
        else:
            pass
print("APPROVED")
N = int(input())
tuplea = tuple(map(int, input().split()))
ans = 0
for n in range(N):
    if tuplea[n]%2 == 1:
        pass
    else:
        if tuplea[n]%3 == 0 or tuplea[n]%5 == 0:
            pass
        else:
            ans = 1
if ans == 0:
    print('APPROVED')   
else:
    print('DENIED')
N = input()
A = list(map(int, input().split()))

for i in A:
    i = int(i)
    if i % 2 == 0:
        if i % 3 !=0 and i % 5 !=0:
            print("DENIED")
            exit()
print("APPROVED")
input()
a = map(int, input().split())
for i in a :
    if i%2==0 and i%3 != 0 and i%5 != 0 :
        print("DENIED")
        break
else:
    print("APPROVED")
def main():
    n = int(input())
    A = map(int,input().split())
    for a in A:
        if (a % 2 == 0):
            if ((a % 3 != 0) and (a % 5 != 0)):
                print("DENIED")
                return
    print("APPROVED")
main()
n = int(input())
a = input().split()
even = []
even_counter = 0
div = 0

for i in a:
  int_a = int(i)
  if int_a % 2 == 0:
    even.append(int_a)
    even_counter += 1

for i in range(even_counter):
  if int(even[i]) % 3 == 0 or int(even[i]) % 5 == 0:
    div += 1

if div == even_counter:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
l = list(map(int, input().split()))

ok = True

for i in l:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ok = False

if ok:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = list(map(int,input().strip().split()))[:n]
flag = True
for i in range(0,n):
    if a[i]% 2 == 0:
        if a[i]% 3 != 0 and a[i]% 5 != 0:
            flag = False
if  flag==True:
    print("APPROVED")
else :
    print("DENIED")
n = int(input())
l = {int(i) for i in input().split() if int(i)%2 == 0}
cnt = 0
for i in l:
    if (i%3 == 0) or (i%5 == 0):
        pass
    else:
         cnt += 1
if cnt == 0:
    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 and i % 5 != 0:
        result = 'No'
        break
    else:
        result = 'Yes'

if result == 'No':
    print('DENIED')
else:
    print('APPROVED')
N = int(input())
a = list(map(int, input().split()))
el = []
for i in a:
    if i % 2 == 0:
        el.append(i)

for i in range(len(el)):
    if el[i] % 3 == 0 or el[i] % 5 == 0:
        el[i] = True
    else:
        el[i] = False

if el.count(False):
    print("DENIED") 
else:
    print("APPROVED")
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
  if a[i]%2 == 0:
    if (a[i]%3)*(a[i]%5) != 0:
      print("DENIED")
      quit()
print("APPROVED")
_ = input()
l = [int(a) for a in input().split(' ') if int(a)%2==0]

fl = 1
for n in l:
  if n%3==0 or n%5==0:
    pass
  else:
    fl = 0
    break

print('APPROVED' if fl else 'DENIED')
N = int(input())
#N,K = map(int, input().split())
flag = False
lst = list(map(int, input().split()))
for elem in lst:
    if elem % 2 == 0:
        if ((elem % 3)==0) or ((elem % 5) ==0):
            pass
        else:
            flag = True
            break
if flag:
    print('DENIED')
else:
    print('APPROVED')
N = int(input())
xs = map(int,input().split())
ans = "APPROVED"
for x in xs:
    if x%2 == 1 or x%3 == 0 or x%5 == 0:
        continue;
    ans ="DENIED"
print(ans)
# B - Papers, Please
# https://atcoder.jp/contests/abc155/tasks/abc155_b

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

even = 0
cnt = 0

for i in a:
    if i % 2 == 0:
        even += 1
        if i % 3 == 0 or i % 5 == 0:
            cnt += 1

if even == cnt:
    print('APPROVED')
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 and a[i]%5!=0:
            print("DENIED")
            sys.exit()

print("APPROVED")
def judgiment(number_num):
  flag = True
  for number in list(map(int, input().split())):
    if number % 2 == 0:
      if not (number % 3 == 0 or number % 5 == 0):
        flag = False
        return flag
        break
    else:
      continue
  return flag

if __name__ == "__main__":
  number_num = int(input())
  flag = judgiment(number_num)
  if flag == True:
    print("APPROVED")
  else:
    print("DENIED")
# 数値の取得
num_cnt = int(input())
num_list = list(map(int,input().split()))

# 数値の検査後メッセージを出力
judge = "APPROVED"
for cnt in range(0,num_cnt,1):
    if num_list[cnt] % 2 == 0\
    and num_list[cnt] % 3 != 0\
    and num_list[cnt] % 5 != 0:
      judge = "DENIED"
      
print(judge)
n = int(input())
A = list(map(int,input().split()))
for a in A:
  if a%2:
    continue
  if a%3==0 or a%5==0:
    continue
  else:
    print('DENIED')
    break
else:
  print('APPROVED')
N = int(input())
A = list(map(int, input().split()))
print("APPROVED" if all(a&1 or (a%3==0 or a%5==0) for a in A) else "DENIED")
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"
            break
    else:
        pass
print(ans)
def solve(string):
    n, *a = map(int, string.split())
    a = [_a % 2 == 1 or _a % 6 == 0 or _a % 10 == 0 for _a in a]
    return "APPROVED" if all(a) else "DENIED"


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
N=int(input())
A=list(map(int,input().split()))
b=0
for x in A:
  if x%2==0:
    if x%3==0 or x%5==0:
      pass
    else:
      b=1
      break
if b==0:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
a = list(map(int, input().split()))
f = 0
for ai in a:
    if ai % 2 == 0:
        if ai % 3 and ai % 5:
            f = 1
            break
if f:
    print('DENIED')
else:
    print('APPROVED')
N = int(input())
A = list(map(int,input().split()))
A_guu = [i for i in A if i % 2 == 0]
A_ans = [i for i in A_guu if i % 3 == 0 or i % 5 == 0]
# print(A_guu)
# print(A_ans)
if A_ans == A_guu:
    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]/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')
n=int(input())
a = list(map(int, input().split()))
for i in a:
  if i % 2==0:
    if i % 3 == 0 or i % 5 ==0:
      continue
    else:
      print('DENIED')
      exit()
      
print('APPROVED')
n=int(input())
a=list(map(int,input().split()))
f=0
g=0
ans="DENIED"
for i in range(n):
  if a[i]%2==0:
    f=1
    if (a[i]%3==0 or a[i]%5==0):
      continue
    else:
      g=1
if f==1 and g==0:
  ans="APPROVED"
if f==0 and ans=="DENIED":
  ans="APPROVED"
print(ans)
input()
A = [v for v in map(int, input().split()) if not v % 2]
for v in A:
    if v % 3 and v % 5:
        print('DENIED')
        break
else:
    print('APPROVED')
N = int(raw_input())
A = map(int, raw_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"

print ans
def please(n , a):

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

def main():
    n = int(input())
    a = list(map(int,input().split()))
    print(please(n , a))

if __name__ == '__main__':
    main()
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=input()
a=list(map(int,input().split()))
for x in a:
    if x%2 == 1:
        continue
    if x%3==0 or x%5 == 0:
        continue
    else:
        print('DENIED')
        break
else:
    print('APPROVED')
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    if a[i] %2 ==0:
        if a[i] % 3 == 0:
            continue
        elif a[i] % 5== 0:
            continue
        else :
            print("DENIED")
            exit()
print("APPROVED")
n = int(input())
a = list(filter(lambda x : x & 1 or x % 3 == 0 or x % 5 == 0, map(int, input().split())))
print('APPROVED' if len(a) == n else 'DENIED')
n=int(input())
a=list(map(int,input().split()))
b=[i for i in a if i%2==0]
c=[k for k in a if k%6==0 or k%10==0]
if len(b)==len(c):
     print('APPROVED')
else:
     print('DENIED')
N = int(input())
alist = list(map(int, input().split()))
flag = 0
for i in range(0,N):
    if alist[i]%2 == 1:
        continue
    else:
        if alist[i]%3 == 0 or alist[i]%5 == 0:
            continue
        else:
            print("DENIED")
            flag = 1
            break
if flag == 0:
    print("APPROVED")
N=int(input())
A=list(map(int, input().split()))
B=[]
for i in range (N):
    if A[i]%2==0:
        B.append(A[i])
count=0
for j in range(len(B)):
    if B[j]%3==0 or B[j]%5==0:
        count=count+1

if count==len(B):
    print("APPROVED")
else:
    print("DENIED")
import sys
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i%2==0:
    if i%3!=0 and i%5!=0:
      print("DENIED")
      sys.exit()
      
print("APPROVED")
n = int(input())
a = list(map(int, input().split()))

flag = True
for i in range(len(a)):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        else:
            flag = False

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

for i in a:
    if not i%2:
        if i%3==0 or i%5==0:
            pass
        else:
            print("DENIED")
            break
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:
            pass
        else:
            bool=False
if bool:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = list(map(int, input().split()))

ret = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            ret = 'DENIED'

print(ret)
import sys
n = input().split()
ln = list(map(int, input().split()))
for l in ln:
  if l % 2 == 1:
    continue
  if l % 3 != 0 and l % 5 != 0:
    print("DENIED")
    sys.exit()
print("APPROVED")
n = int(input())
x = list(map(int,input().split()))
for i in x:
    if(i%2==0 and (i%3!=0 and i%5!=0)):
        print("DENIED")
        break
else:
    print("APPROVED")
N = int(input())
A = list(map(int, input().split()))
flag = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = False

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

num2=[]
for i in num:
    if i%2==0:
        num2.append(i)
num3=[]        
for j in num2:
    if j%3==0 or j%5==0:
        num3.append(0)
    elif j%3!=0 or j%5!=0:
        num3.append(1)

a=sum(num3)

if a==0:
    print("APPROVED")
elif a!=0:
    print("DENIED")
N = int(input())
A = list(map(int,input().split()))
s = "APPROVED"
for i in range(N):
    if (A[i] % 2 == 0):
        if (A[i] % 3 != 0) and (A[i] % 5 != 0):
            s = "DENIED"

print(s)
def main():
    N = int(input())
    A = list(map(int, input().split()))

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

    print("APPROVED")


if __name__ == "__main__":
    main()
N = int(input())
A = list(map(int, input().split()))
flag = False
count1 = 0
count2 = 0
flag = False
for i in range(N):
  if A[i]%2 == 0:
    count1 += 1
    if A[i]%3==0 or A[i]%5==0:
      count2 += 1
      
if count1 == count2:
  flag = True

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

for i in lst:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            break
else:
    print('APPROVED')
N = int(input())
lis = list(map(int,input().split()))
result = "APPROVED"
for i in lis:
    if i %2 ==0:
        if i %3 !=0 and i%5 !=0:
            result = "DENIED"
            break
print(result)
n=int(input())
number=[int(i) for i in input().split()]

for i in range(n):
  if number[i]%2==1 or number[i]%3==0 or number[i]%5==0:
    number[i]=0
    
if all(number[i]==0 for i in range(n)):
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
A = list(map(int, input().split()))
for num in A:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 == 0:
            pass
        else:
            print('DENIED')
            break
else:
    print('APPROVED')
input()
A=list(map(int,input().split()))
print("APPROVED" if all(a&1 or a%3==0 or a%5==0 for a in A) else "DENIED")
n = int(input())
v = list(map(int, input().split(' ')))

approved = True
for val in v:
	if (val % 2 == 0):
		if (val % 3 != 0 and val % 5 != 0):
			approved = False
			
if (approved):
	print('APPROVED')
else:
	print('DENIED')
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
a_list = list(map(int, input().split()))
flag = 1
for a in a_list:
    if a % 2 == 0:
        if a % 3 == 0 or a % 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()))
c=0
for i in range(len(a)):
  if a[i]%2==0 and a[i]%3 != 0 and a[i]%5 != 0:
    c=c+1
  if c != 0:
    break
if c==0:
  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]%3!=0 and a[i]%5!=0:
      ans="DENIED"
print(ans)
#B - Papers, Please
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:
            pass
        else:
            print("DENIED")
            exit()
    else:
        pass

print("APPROVED")
n = int(input())
a = list(map(int, input().split()))
for i in a:
    if i % 2 == 0:
        if (i % 5)*(i % 3) != 0:
            print('DENIED')
            exit()
print('APPROVED')
n = int(input())
nums = list(map(int, input().split()))

ans = 'APPROVED'

for i in nums:
    if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
        ans = 'DENIED'

print(ans)
a = input()
b = map(int, input().split())

s = [c for c in b if c%2 == 0]

for p in s:
  if (p % 3 != 0) & (p % 5 != 0):
    print("DENIED")
    break
else:
  print("APPROVED")
#N
n = int(input())
#a
a = list(map(int, input().split()))

#flg
out_flg = "N"

for i in range(len(a)):
    if a[i] %2 == 0 and a[i] %3 != 0 and a[i] %5 != 0:
        out_flg = "Y"
        break

if out_flg == "Y":
    print("DENIED")
else:
    print("APPROVED")
n=(int(input()))
li=list(map(int,input().split()))
ln=[i for i in li if i%2==0]
for j in ln:
  if j%3==0 or j%5==0:
    pass
  else:
    print("DENIED")
    exit()
print("APPROVED")
N=int(input())
A=list(map(int,input().split()))
B=[]
C=[]
for i in A:
    if i%2==0:
        B.append(i)
for i in B:
    if i%3==0 or i%5==0:
        C.append(i)
if len(B)==len(C):
    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 and a[i] % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")
n = int(input())
paper = list(map(int,input().split()))

paper_even = [i for i in paper if i % 2 == 0 ]

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

if count == len(paper_even):
    print('APPROVED')
else:
    print('DENIED')
import sys
n = int(input())

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

for i in range(n):
  if a[i] % 2 != 0:
    continue
  else:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
      pass
    else:
      print('DENIED')
      sys.exit()
      

print('APPROVED')
n=int(input())
l=list(map(int,input().split()))
ans="APPROVED"
for i in l:
	if i%2==0 and i%3 and i%5:
		ans="DENIED"
print(ans)
N = int(input())
A = list(map(int,input().split()))
flag = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 != 0:
            if a % 5 != 0:
                flag = 'DENIED'
                break
print(flag)
def main():
    N = int(input())
    A = list(map(int, input().split()))
    approve = True
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass # ok
            else:
                approve = False
                break
    if approve:
        print('APPROVED')
    else:
        print('DENIED')

    

main()
N = int(input())
l = list(map(int, input().split()))

L = [i for i in l if i % 2 == 0]
K = [i for i in L if i % 3 != 0]
J = [i for i in K if i % 5 != 0]

if len(J) == 0:
		print("APPROVED")
else:
        print("DENIED")
n = int(input())
list_num = list(map(int, input().split()))
flg = False
for i in range(n):
  if list_num[i] % 2 == 1 or (list_num[i] % 2 == 0 and (list_num[i] % 3 == 0 or list_num[i] % 5 == 0)):
    flg = True
  else:
    flg = False
    break

if flg:
  print("APPROVED")
else:
  print("DENIED")
_ = 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')
		break
else:
	print('APPROVED')
N=int(input())
A=map(int, input().split())
def judge(L):
  for a in L:
    if a%2==0:
      if a%3!=0 and a%5!=0:
        return False
  return True

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

if all(map(lambda x: x % 2 == 1 or x % 3 == 0 or x % 5 == 0, A)):
    print('APPROVED')
else:
    print('DENIED')
import sys

N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a % 2 == 0 and (a % 3 != 0 and a % 5 != 0):
        print('DENIED')
        sys.exit()
print('APPROVED')
N = input()
nums = input().split()
num_list = [int(i) for i in nums]

mes = "APPROVED"
for num in num_list:
  if num % 2 ==0:
    if num % 3 == 0 or num % 5 == 0:
      pass
    else:
      mes = "DENIED"
print(mes)
N = int(input())
A = [int(a) for a in input().split()]

for i in range(N):
    if A[i] % 2 == 1:
        A.remove(A[i])
        A.insert(i,0)
for i in range(len(A)):
    if A[i] % 3 != 0 and A[i] % 5 != 0:
        print('DENIED')
        exit()
print('APPROVED')
def resolve():
    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")
                return
    print("APPROVED")

if '__main__' == __name__:
    resolve()
N = int(input())
A_list = list(map(int, input().split()))
 
f = True
for a in A_list:
  if a % 2 == 1:
    continue
  elif a % 3 == 0 or a % 5 == 0:
    continue
  else:
    f = False
    
if f:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())


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


ok_list = []
ng_list = []

for i in num:
    if i % 2 == 1:
        ok_list.append(i)

    elif i % 3 == 0 or i % 5 == 0:
        ok_list.append(i)

    else:
        ng_list.append(i)

if not ng_list:
    print("APPROVED")
else:
    print("DENIED")
_ = input()
a=map(int,input().split())
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
a = list(map(int,input().split()))

ok = True
for i in range(n):
  x = a[i]
  if x % 2 == 0:
    if x % 3 == 0 or x % 5 == 0:
      continue
    else:
      ok = False

if ok:
  print("APPROVED")
else:
  print("DENIED")
# -*- coding: utf-8 -*-
import numpy as np

N= int(input())

# スペース区切りの整数の入力
list = list(map(int, input().split()))


flag=True


for num in range(N):
    q, mod = divmod(list[num], 2)
    if mod==0:
        q, mod3 = divmod(list[num], 3)
        q, mod5 = divmod(list[num], 5)
        if mod3!=0 and mod5!=0:
           flag=False


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

l=[]
for i in a:
    if i%2==0:
        l.append(i%3==0 or i%5==0)
print("APPROVED" if all(l) else "DENIED")
N = int(input())
List=list(map(int,input().split()))
ans = 0
a = 1

for i in List:
  if i%2 == 0:
    if i%3 == 0 or i%5 == 0:
      a=1      
    else:
      ans = 1
      
if ans == 1:
  print("DENIED")
else:
  print("APPROVED")
n = int(input())
a = [int(i) for i in input().split()]
approved = True

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        else:
            approved = False

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

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

if count == len(A):
    print("APPROVED")
N = int(input())
A = list(map(int, input().split()))
f = True
for i in range(N):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
      f = False
if f:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
a = [int(x) for x in input().split()]
ans = "APPROVED"
for a_i in a:
    if a_i % 2 != 0: continue
    else:
        if a_i % 3 != 0 and a_i % 5 != 0:
            ans = "DENIED"
            break
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 or i % 5 == 0:
            pass
        else:
            flag = 1
            break

if flag == 1:
    print('DENIED')
else:
    print('APPROVED')
n = int(input())
l = list(map(int, input().split()))
ans = 'APPROVED'
for i in l:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            ans = 'DENIED'
print(ans)
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:
                continue
            else:
                flag = False

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


if __name__ == "__main__":
    main()
#  --*-coding:utf-8-*--

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

for a in A:
    if a%2 == 0 and not(a%3 == 0 or a%5 == 0):
        print('DENIED');
        break
else:
    print('APPROVED');
N = int(input())
A = [int(_) for _ in input().split()]

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