peterverebics/CodeNet_Python_118 huggingface dataset:
import sys
import math

n = int(input())
a = list(map(int, input().split()))
flg = 0
b = []
for i in range(n):
    if a[i] % 2 == 0:
        b.append(a[i])
for i in range(len(b)):
    if b[i] <= 2:
        flg = 1
    elif b[i] % 3 != 0 and b[i] % 5 != 0:
        flg = 1
if flg == 0:
    print("APPROVED")
else:
    print("DENIED")
num = int(input())
num_list = list(map(int,input().split()))

sign = 0

for i in range(0,num):
  if num_list[i]%2 == 0:
    if not (num_list[i]%3 == 0 or num_list[i]%5 == 0):
      sign = 1

if sign == 0:
  ans = "APPROVED"
elif sign == 1:
  ans = "DENIED"
  
print(ans)
def abc155_b():
    N = int(input())
    A = list(map(int, input().split()))
    result = 'APPROVED'

    evens = [i for i in A if i % 2 == 0]
    for i in evens:
        if (i % 3 != 0) and (i % 5 != 0):
            result = 'DENIED'

    print(result)


##########
if __name__ == "__main__":
    abc155_b()
n = int(input())
a = list(map(int,input().split()))
ans=0
ans2=0
for i in a:
  if i % 2 == 0:
    ans +=1
    if i % 3 == 0 or i % 5 == 0:
      ans2 +=1
if ans == ans2:
  print('APPROVED')
else:
  print('DENIED')
N = int(input())
A = [int(x) for x in input().split()]
B = []
for i in A:
  if i%2 == 0:
    B.append(i)
count = 0
for j in B:
  if j%3 == 0 or j%5 == 0:
    count = count + 1
if count >= len(B):
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
a = list(map(int, input().split()))

ans = "APPROVED"
for x in a:
  if (x % 2 == 0):
    if (x % 3 != 0 and x % 5 != 0):
      ans = "DENIED"
print(ans)
n = int(input())
l = list(map(int,input().split()))

flag = True
for i in l:
  if (i%3 != 0 and i%2 == 0) and (i%5 != 0 and i%2 == 0):
    flag = False
    break
    
if flag:
  print("APPROVED")
  
else:
  print("DENIED")
n = int(input())
flag = True
for a in map(int, input().split()):
  if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
    flag = False
    break
if flag:
  print('APPROVED')
else:
  print('DENIED')
n = int(input())
for a in list(map(int, input().split())):
    if not a % 2 and a % 3 and a % 5:
        print("DENIED")
        break
else: print("APPROVED")
n = int(input())
a = list(map(int,input().split()))
tmp = 0
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            tmp += 1
if tmp == 0:
    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:
        check2+=0
if check1 == check2:
    print("APPROVED")
elif check1 != check2:
    print("DENIED")
n=int(input())
alis=list(map(int,input().split()))
for i in range(n):
  
  if alis[i]%2==0:
    if alis[i]%3!=0 and alis[i]%5!=0:
      print('DENIED')
      exit()

print('APPROVED')
N = int(input())
ans = 'APPROVED'

for a in map(int, input().split()):
    if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
        ans = 'DENIED'

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

A= [i for i in A if i%2==0]
if len( [j for j in A if not ((j%3==0)or(j%5==0))]) == 0:
    print("APPROVED")
else:
    print("DENIED")
num_val = input()
num_list = list(map(int, list(input().split())))

even_list = [i for i in num_list if (i%2==0) & (i%3!=0 and i%5!=0)]
if len(even_list) == 0:
    print('APPROVED')
else:
    print('DENIED')
N = int(input())
A = list(map(int, input().split()))
temp_list = []
flag = 1

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

for i in range(len(temp_list)):
  if not (temp_list[i] % 3 == 0 or temp_list[i] % 5 == 0):
    flag = 0
    
if flag == 1:
  print('APPROVED')
else:
  print('DENIED')
N = int(input())
A = list(map(int, input().split()))

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

flag = True
for val in el:
  if val%3 != 0 and val%5 != 0:
    flag = False

if flag:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a % 2 == 1:
        continue
    elif a % 3 == 0 or a % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()

print("APPROVED")
n = int(input())
Lists=list(map(int,input().split()))
x = 0
for i in Lists:
    if i%2==0 and i%3 !=0 and i%5!=0:
        print("DENIED")
        x = 1
        break

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


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

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

flag = 1
for i in range(len(A)):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      flag = 0
      break
print(['DENIED', 'APPROVED'][flag])
N = int(input())
A = list(map(int, input().split()))
A_e = []

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


cnt = 0
for j in range(len(A_e)):
    if (A_e[j]%3 == 0) or (A_e[j]%5 == 0):
        cnt += 1
    else:
        cnt = cnt

if cnt == len(A_e):
    print('APPROVED')
else:
    print('DENIED')
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    A = [int(x) for x in stdin.readline().rstrip().split()]
    result = 'APPROVED'
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                result = 'DENIED'
                break
    print(result)
n = int(input())
li = list(map(int, input().split()))
f = 1
for i in li:
    if i & 1 == 0:
        if i%3 != 0 and i%5 != 0:
            f = 0
            break
print('APPROVED') if f else print('DENIED')
from sys import exit

N = int(input())

for i in input().split():
    if int(i) % 2 == 0:
        if int(i) % 3 != 0 and int(i) % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')
N = int(input())
is_approved = True
l = list(map(int, input().split()))
for i in l:
    if i % 2 == 0:
        if not (i % 5 == 0 or i % 3 == 0):
            is_approved = False
            break
print('APPROVED' if is_approved else 'DENIED')
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")
            exit()
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 and a[i] % 5 != 0:
            print('DENIED')
            exit(0)
print('APPROVED')
N = int(input())
a = list(map(int,input().split()))

flag = True
for a_i in a:
    if a_i%2==0:
        if not (a_i%3==0 or a_i%5==0):
            flag=False

print("APPROVED" if flag else "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 and a[i] % 5 != 0:
      flag = 1
print("APPROVED") if flag == 0 else print("DENIED")
N=int(input())
A=input().split()
x=0
for i in range(N):
  if int(A[i])%2==0:
    if int(A[i])%5==0 or int(A[i])%3==0:
      x+=1
  else:
    x+=1
if x==N:
  print('APPROVED')
else:
  print('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:
            pass
        else:
            print("DENIED")
            exit()
            

print("APPROVED")
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 = input()
As = input().split(" ")

judge = True

for A in As:
    A=(int)(A)
    if A %2 ==0:
        if A%3 != 0 and A%5 != 0:
            judge=False
            break


if judge:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
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

if sw1 >= 0 and sw1 == sw2:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = list(map(int, input().split()))
k = 0
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            k += 1
    else:
        pass

if k != 0:
    print('DENIED')
else:
    print('APPROVED')
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
*A, = map(int, input().split())
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")
N=int(input())
a=list(map(int,input().split()))
arr=[]
for A in a:
    if A%2==0:
        arr.append(A)
    else:
        pass

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

if flag == True:
    print('APPROVED')
else:
    print('DENIED')
n=int(input())
list=[[0]*n]
list=input().split()
g=0
c=0
for i in range(n):
  list[i]=int(list[i])
  if list[i]%2==0:
    g+=1
    if list[i]%3==0 or list[i]%5==0:
      c+=1
if g==c:
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
data = input().split()
 
ans = "APPROVED"
 
for i in range(n):
  num = int(data[i])
  if num % 2 == 0:
    if num % 3 != 0 and num % 5 != 0:
      ans = "DENIED"
      break  
 
print(ans)
n = int(input())
a = list(map(int,input().split()))
ans = 0

for i in a:
  if i%2 ==0 and (i%3 !=0 and i%5 != 0):
    ans += 1
  else:
    pass
  
if ans >0:
  print("DENIED")
else:
  print("APPROVED")
N = int(input())
A = list(map(int,input().split()))
 
ans = 'APPROVED'
for i in A:
    if i % 2 == 0:
        if i % 3 == 0:
            pass
        elif i % 5 == 0:
            pass
        else:
            ans = 'DENIED'
print(ans)
def solve():
    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')


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

ans = "APPROVED"
for i in range(n):
    if ans =="APPROVED":
        if a[i]%2 == 0:
            b = a[i]%3
            c = a[i]%5
            if b == 0 or c == 0:
                ans = "APPROVED"
            else: 
                ans = "DENIED"
    else:
        ans = "DENIED"
print(ans)
N = int(input())
A = [int(i) for i in input().split() if int(i) % 2 == 0]
t = 0
for x in A:
    if x % 3 != 0 and x % 5 != 0:
        t += 1
if t == 0:
    print('APPROVED')
else:
    print('DENIED')
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")
      exit()
    else:
      pass
  else:
    pass
  
print("APPROVED")
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
import numpy as np
def main():
    a = np.fromstring(read(), np.int64, sep=' ')[1:]
    a = a[a % 2 == 0]
    if np.all((a % 3 == 0) | (a % 5 == 0)):
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int, input().split()))

res = True

for num in A:
    if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
        res = False
        break

print(['DENIED', 'APPROVED'][res])
n=int(input())
lists=list(map(int,input().split()))
flag=True
for i in range(n):
    if lists[i]%2==0 and (lists[i]%3!=0 and lists[i]%5!=0):
        flag=False
if flag:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
list = list(map(int, input().split()))

immigre = 'APPROVED'
for num in list:
  if num % 2 == 0:
    if (num % 3 != 0) and (num % 5 != 0):
      immigre = 'DENIED'
print(immigre)
def main():
    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")
                exit()
    print("APPROVED")

if __name__ == "__main__":
    main()
N = int(input())
A = list(map(int,input().split()))

f = 0
for a in range(len(A)):
  if A[a] % 2 != 0:
    continue
  else:
    if A[a] % 3 != 0 and A[a] % 5 != 0:
      f = 1
      break
      
if f == 1:
  print('DENIED')
else:
  print('APPROVED')
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:
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")
n_num = int(input())
nums = map(int, input().split())

for num in nums:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            print('DENIED')
            break
else:
    print('APPROVED')
n =int(input())
a =list(map(int, input().split()))

flg = True

for x in a:
    if x % 2 != 0:
        continue
    if x % 3 != 0 and x % 5 != 0:
        flg = False

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

flag = 1
for a in A:
    if a % 2 == 0:
        if ((a % 3 == 0) or (a % 5 == 0)):
            1
        else:
            print("DENIED")
            exit()
print("APPROVED")
n = int(input())
a = list(map(int,input().split()))
count = 0
count2 = 0
for i in a:
    if i%2 == 0:
        count += 1 
        if  i%3 == 0 or i%5 == 0:
            count2 += 1
if count == count2:
    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'
            break
print(ans)
import sys

n = int(input())
a = [num for num in map(int, input().split())]

# print(n)
# print(a)

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


for i in a:
    if i % 2 == 0:
        if i % 3 == 0:
            continue
        elif i % 5 == 0:
            continue
        else:
            print('DENIED')
            exit()

print('APPROVED')
n=int(input())
a=list(map(int,input().split()))
flg=0
for i in range(n):
  if a[i]%2==0:
    if a[i]%3!=0 and a[i]%5!=0:
      flg=1

if flg==0:
  print("APPROVED")
else:
  print("DENIED")
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    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')
                exit(0)

    print('APPROVED')


if __name__ == "__main__":
    main()
def main():
    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:
                return ("DENIED")
    return ("APPROVED")

print(main())
N = int(input())
a_list = list(map(int, input().split()))
c = 0

for i in range(N):
    if a_list[i]  % 2 != 0:
        a = 1
    else:
        if (a_list[i] % 3 != 0) and (a_list[i] % 5 != 0):
            c = 1
        else:
            a = 1


if c == 1:
    print("DENIED")
else:
    print("APPROVED")
N = int(input())
A = list(map(int,input().split(" ")))
for a in A:
    if a%2 == 0:
        if a%3 != 0 and a%5 != 0:
            print('DENIED')
            exit()
print('APPROVED')
N = int(input())
A = list(map(int, input().split()))

flag = 1

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

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


for a in aa:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      pass
    else:
      print('DENIED')
      break
else:
  print('APPROVED')
# 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("APPROVED")
n = int(input())
a = list(map(int, input().split()))

for i in a:
    if i % 2 == 0:
        if i % 6 > 0 and i % 10 > 0:
            print('DENIED')
            exit()
print('APPROVED')
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')
            exit()
print('APPROVED')
N = int(input())
A = list(map(int,input().split()))
flg = 0

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0 and A[i] % 5 != 0 :
            flg = 1
            break
        elif A[i] % 3 == 0:
            flg = 0
        elif A[i] % 5 == 0:
            flg = 0
        else:
            flg = 1

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

cnt = 0
for i in l:
    if i%3 == 0 or i%5==0:
        cnt += 1
    else:
        break

if cnt == len(l):
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
lis = list(map(int,input().split()))
for num in lis:
    if num % 2 == 0:
        if num % 3 != 0:
            if num % 5 != 0:
                print("DENIED")
                exit()
print("APPROVED")
n = int(input())
ls = list(map(int, input().split()))

for i in range(n):
    if ls[i] % 2 == 1:
        if i == n - 1:
            print("APPROVED")
    elif ls[i] % 2 == 0:
        if ls[i] % 3 == 0 or ls[i] % 5 == 0:
            if i == n - 1:
                print("APPROVED")
        else:
            print("DENIED")
            break
n = int(input())
aa = [int(x) for x in input().split()]
def ok(x):
    return x % 2 == 1 or (x % 3 == 0 or x % 5 == 0)
if all(ok(x) for x in aa):
    print('APPROVED')
else:
    print('DENIED')
n = int(input())
a = tuple(map(int, input().split()))
cnt = len(list(filter(lambda x: x % 2 == 1 or (x % 3 == 0 or x % 5 == 0), a)))
ans = 'APPROVED' if cnt == n else 'DENIED'
print(ans)
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')
            exit()
print('APPROVED')
import math

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

hantei = True

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

if hantei == True:
  print('APPROVED')
else:
  print('DENIED')
a=int(input())
list=map(int,input().split())
list2=[]
list3=[]
for x in list:
    if x%2==0:
        list2.append(x)
for y in list2:
    if y%3!=0 and y%5!=0:
        list3.append(y)
s=len(list3)
if s==0:
    print("APPROVED")
else:
    print("DENIED")
# -*- coding: utf-8 -*-

# 整数の入力
a = int(input())
# スペース区切りの文字列の入力
st = input().split()
st_list = []
st_list = [int(st) for st in st]

num = 0
flg = 0
for num in range(len(st_list)):
  if(st_list[num] % 2 == 0):
    if(st_list[num] % 5 != 0 and st_list[num] % 3 != 0):
      flg = 1
if(flg == 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 and i % 5 != 0:
            print('DENIED')
            exit()
print('APPROVED')
N = int(input())
A = list(map(int, input().split()))

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


def is_approve(a:list):
  ans = False
  for num in a:
    if num % 2 == 1 :
      ans = True
    elif num % 3 == 0 or num % 5 == 0:
      ans = True
    else:
      ans = False
      break
  return ans

if is_approve(a):
  print('APPROVED')
else:
  print('DENIED')
n=int(input())
a = list(map(int,input().split()))
even=[el for el in a if el % 2==0]
try:
  for a in even:
    if a % 3 == 0 or a % 5 == 0:
      flg = 1
    else:
      raise
except:
  print('DENIED')
else:
  print('APPROVED')
n=input()
a=list(map(int,input().split()))
b=[i for i in a if i%2==0]
c=len(b)
d=[i for i in b if i%3==0]
e=len(d)     
f=[i for i in b if i%5==0]
g=len(f)
h=[i for i in b if i%15==0]
j=len(h)
if c==e+g-j:
    print("APPROVED")
else:
    print("DENIED")
N=int(input())
A=list(map(int,input().split()))
b=True
for a in A:
    if a%2==0:
        if not (a%3==0 or a%5==0):
            b=False
print("APPROVED" if b else "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:
            if a[i]%5 != 0:
                print("DENIED")
                exit()
                
print("APPROVED")
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
	if a[i] % 2 == 1: continue
	if a[i] % 3 != 0 and a[i] % 5 != 0:
		print("DENIED")
		break
else:
	print("APPROVED")
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    pass
print(ans)
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
N = int(input())
A = [int(x) for x in input().strip().split()]

for a in A:
    if a % 2:
        continue
    if a % 3 != 0 and a % 5 != 0:
        print('DENIED')
        exit()
else:
    print('APPROVED')
N=int(input())
A=list(map(int,input().split()))
a=[i for i in A if i%2==0]
b=len([i for i in a if i%3==0 or i%5==0])
if len(a)==b:
    print('APPROVED')
else:
    print('DENIED')
input()
aa = [int(i) for i in input().split()]

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

print(ans)
n=int(input())
a=list(map(int,input().split()))
f=1
for i in range(n):
    if a[i]%2:
        continue
    else:
        if a[i]%3==0 or a[i]%5==0:
            continue
        else:
            f=0
if f:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = list(map(int, input().split()))
ans = True
for a in A:
    if a % 2 == 0:
        if not (a % 5 == 0 or a % 3 == 0):
            ans = False
print("APPROVED" if ans else "DENIED")
input()
xs=[int(x) for x in input().split(' ')]
for x in xs:
  if x%2==0:
    if x%3!=0 and x%5!=0:
      print('DENIED')
      exit(0)
print('APPROVED')