peterverebics/CodeNet_Python_118 huggingface dataset:
def inpl():
    return list(map(int, input().split()))


N = int(input())

A = inpl()

flag = True
for a in A:
    if a % 2 == 1:
        pass
    elif a % 3 == 0 or a % 5 == 0:
        pass
    else:
        flag = False

print("APPROVED" if flag 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 and A[i] % 5 != 0:
      print("DENIED")
      break
  else:
    pass
else:
  print("APPROVED")
n=int(raw_input())
a=map(int,raw_input().split())
invalid=1
for i in a:
    if(i%2==0):
        if(i%3==0 or i%5==0):
            pass
        else:
            invalid=0
            break
if(invalid==1):
    print "APPROVED"
else:
    print "DENIED"
N = int(input())
p = 'APPROVED'

for i in map(int, input().split()):
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      p = 'DENIED'
print(p)
number = input()
num_list = input().split(" ")
odd_list = []
for i in num_list:
	if int(i) % 2 == 0:
		odd_list.append(i)
	else:
		pass
ans = 0
for j in odd_list:
    if int(j) % 5 == 0:
        ans += 1
    elif int(j) % 3 == 0:
        ans = ans + 1
    else:
        pass
if ans >= len(odd_list):
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = list(map(int, input().split()))

flg = 0

for a in A:
	if a % 2 == 0:
		if a % 3 != 0 and a % 5 != 0:
			flg = 1
			break
			
if flg:
	print("DENIED")
else:
	print("APPROVED")
N=int(input())
L=list(map(int,input().split()))
count=0
for i in range(N):
	if L[i]%2==0:
		if L[i]%3!=0 and L[i]%5!=0:
			count=1
if count==0:
	print("APPROVED")
else:
	print("DENIED")
def main():
    n = int(input())
    s = list(map(int,input().strip().split()))
    e = []
    for ss in s:
        if ss % 2 == 0:
            e.append(ss)
    
    for ee in e:
        if ee % 3 == 0 or ee % 5 == 0:
            continue
        else:
            print("DENIED")
            return
    
    print("APPROVED")
    return

main()
def solve():
    n = int(input())
    a = map(int, input().split())
    even = [e for e in a if e % 2 == 0]
    for i in even:
        if i % 3 != 0 and i % 5 != 0:
            print('DENIED')
            exit()
    print('APPROVED')


if __name__ == '__main__':
    solve()
import sys

n = int(input())
l = list(map(int, input().split()))
for i in range(n):
    if l[i]%2 == 0 and l[i]%3 != 0 and l[i]%5 != 0:
        print("DENIED")
        sys.exit(0)
print("APPROVED")
n=int(input())
a=[int(j) for j in input().split()]
for i in a:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            print("DENIED")
            exit()
print("APPROVED")
import sys
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')
        sys.exit()
print('APPROVED')
input_int = int(input())
input_list = list(map(int,input().split()))
count_2 = 0
count_3_5 = 0

for i in input_list:
    if i % 2 == 0:
        count_2 += 1
        if i % 3 == 0 or i % 5 == 0:
            count_3_5 += 1

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

res = 'APPROVED'
for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            res = 'DENIED'
            break

print(res)
n = int(input())
numbers = list(map(int, input().split()))
flg = True
for number in numbers:
    if number % 2 == 0 and number % 3 != 0 and number % 5 != 0:
        flg = False
        break

if flg:
    print("APPROVED")
else:
    print("DENIED")
input()
a = [int(i) for i in input().split()]
ok = True
for i in a:
    if i%2 == 0:
        if i%5 != 0 and i%3 != 0:
            print("DENIED")
            ok = False
            break
if ok:
    print("APPROVED")
def jud_oe(x):
    if x%2 == 0:
        if (x%3 == 0) or (x%5 ==0):
            return 1
        else:
            return 0
    else:
        return 1


n = int(input())
a = list(map(int,input().split()))
b = list(map(jud_oe,a))
judge = 0 in b
# print(b)
if judge:
    print("DENIED")
else:
    print("APPROVED")
n=int(input())
A=[int(i) for i in input().split()]
Chk=True
for a in A:
    if a%2==0:
        if a%3!=0 and a%5!=0:
            Chk=False
if Chk:
    print("APPROVED")
else:
    print("DENIED")
N = int(input())
A = input().split()
A = [int(a) for a in A if int(a) % 2 == 0]

tmp = 0

for a in A:
  if a % 3 == 0 or a % 5 == 0:
    tmp += 1

if tmp == len(A):
  print('APPROVED')
else:
  print('DENIED')
n = int(input())
a = [int(_) for _ in input().split()]

for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()
    else:
        pass
print('APPROVED')
n=input()
list=[int(x) for x in input().split()]
count=0
newlist=[int(x) for x in list if x%2==0]
s=[int(x) for x in newlist if x%3==0 or x%5==0]
if len(s)==len(newlist):
  print("APPROVED")
else:
  print("DENIED")
n = int(input())
l = [int(i) for i in input().split()]
x = str()
for i in range(n):
  if (l[i] % 2 == 0 and (l[i] % 3 == 0 or l[i] % 5 == 0)) or l[i] % 2 == 1:
    x = 'APPROVED'
    continue
  else:
    x = 'DENIED'
    break
print(x)
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 or A[i]%5==0:
            pass
        else:
            Ans="DENIED"
    else:
        pass

print(Ans)
n = int(input())
a = list(map(int, input().split()))
for x in a:
    if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
        print('DENIED')
        exit(0)
print('APPROVED')
b=[]
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i %2==0:
    b.append(i)
cnt=0
for i in b:
  if i%3==0 or i%5==0:
    cnt+=1
if cnt==len(b):
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
count=0
total_count=0

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

for x in list:
    if int(x)%2==0:
        if int(x)%3==0 or int(x)%5==0:
            total_count +=1
    else:
        total_count+=1
    count+=1

if total_count==int(N):
    print('APPROVED')

else:
    print('DENIED')
n=input()
for a in map(int,input().split()):
  if a % 2 == 0:
    if not (a%3==0 or a%5==0):
      print("DENIED")
      exit()   
print("APPROVED")
N = int(input())
L = list(map(int,input().split()))

ans = True

for i in L:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            ans = False
            break

if  ans:
    print("APPROVED")
else:
    print("DENIED")
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N = input()
    A = [int(i) for i in input().split()]
    even = list(filter(lambda x: x % 2 == 0, A))
    print('APPROVED' if len(even) == len(list(filter(lambda x: x % 3 == 0 or x % 5 == 0, even))) else 'DENIED')

    return

if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int,input().split()))
flag = 1
for i in range(N):
    if (A[i]%(2*3) == 0) or(A[i]%(2*5) == 0) or( A[i]%(2) == 1):
        flag = 1
    else:
        flag = 0
        print('DENIED')
        break
if flag == 1:
    print('APPROVED' )
n = int(input())
a = [int(i) for i in input().split()]
ans = "APPROVED"
for i in a:
    if i%2 == 0 and i%3 != 0 and i%5 != 0:
            ans = "DENIED"
            break
print(ans)
n=int(input())
A=list(map(int,input().split()))
isApprove=True
for i in range(n):
  if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
    isApprove=False
    break
print('APPROVED' if isApprove else 'DENIED')
n=int(input())
a=list(map(int,input().split()))

p=[]
for i in range(n):
    p.append(1)

z=0
for i in range(n):
    if a[i]%2==1:
        p[i]=0
    else:
        if a[i]%6==0:
            p[i]=0
        elif a[i]%10==0:
            p[i]=0
    z=z+p[i]

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

B = list()
for i in range(len(A)):
    if A[i] % 2 == 0:
        B.append(A[i])

C = 0
for i in range(len(B)):
        if (B[i] % 3 == 0) or (B[i] % 5 == 0):
            C += 1 
    
if len(B) == C:
    print("APPROVED")
else :
    print("DENIED")
n = int(input())
l = list(map(int,input().split()))

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

flag =True

for i in A:
    if i%2 == 0:
        if i%3 ==0:
            flag = True
        elif i%5 == 0:
            flag = True
        else:
            flag = False
            break
            
if flag:
    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 or A[i] % 6 == 0 or A[i] % 10:
    continue
  else:
    ans = 'DENIED'
    break

print(ans)
n = int(input())
list = map(int,input().split())

list2=[]
for i in list:
    if i%2==0:
        list2.append(i)

if list2:
    if all(i%3==0 or i%5==0 for i in list2):
        print('APPROVED')
    else:
        print('DENIED')
else:
    print('DENIED')
N = int(input())
A = list(map(int, input().split()))
count = 0
for ele in A:
    if ele % 2 != 0:
        A.remove(ele)
for ele in A:
    if ele % 3 == 0 or ele % 5 == 0:
        count += 1
print("APPROVED" if count == len(A) else "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:
    print("DENIED")
else:
  print("APPROVED")
input()
a = list(map(int, input().split()))
b = []
for i in range(len(a)):
  if (a[i] % 2) == 0:
    if (((a[i] % 3) == 0) or ((a[i] % 5) == 0)):
      b.append(True)
    else: 
      b.append(False)
if (len(b) == 0) or (False in b):
  print("APPROVED")
else:
  print("DENIED")
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(A) ==0:
        print('APPROVED')
elif len(B) ==0:
    print('DENIED')
else:
    if len(A) == len(B) :
        print('APPROVED')
    else:
        print('DENIED')
# input
N = int(input())
A = list(map(int, input().split()))

# check
app_fl = True
for Ai in A:
    if Ai % 2 == 0 and (Ai % 3 != 0 or Ai % 5 != 0):
        app_fl = False
        break

if app_fl is True:
    print("APPROVED")
else:
    print("DENIED")
a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a):
  if b[i]%2==0:
    if b[i]%3==0 or b[i]%5==0:
      c=c+1
if c==a:
  print("APPROVED")
else:
  print("DENIED")
import sys
# N=5
# A=[6, 7, 9, 10, 31]
N=map(int,input())
A=list(map(int, input().split()))

A_even=[]
for i in A:
    if  (i%2)==0:
        A_even.append(i)
for i in A_even:
    if (i%3)==0 and (i%5)==0:
        print("DENIED")
        sys.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 or A[i]%5==0:
      print('APPROVED')
      exit()

print('DENIED')
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
    else:
        if list[i]%3!=0 and list[i]%5!=0:
            break
        else:
            result = 'APPROVED'
print(result)
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in A:
  if i//3 == 0 or i//5 == 0:
    count += 1
  else:
    count += 0
    
if count == N:
  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 or i%5!=0:
      print("DENIED")
      sys.exit()

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

#6,10の倍数になれば良い

count = 0
ok_count = 0
for i in range(len(a)):
    if a[i]%2  == 0:
        count += 1
        if a[i]%3 == 0 or a[i]%5 == 0 or a[i]%3 == 0 and a[i]%5 == 0:
            ok_count += 1
if count == ok_count:
    print('APPROVED')
else:
    print('DENIED5')
line1 = input('')
line2 = input('') 
result = True
cnt = int(line1)
list = line2.split(' ')
if len(list) != cnt:
  result = False
if result:
  for no_str in list:
    no = int(no_str)
    if no % 2 == 0:
      print(no)
      if no % 3 != 0 and no % 5 != 0:
        print(no)
        result = False

if result :
  print('APPROVED')
else:
  print('DENIED')
N=int(input())
A=list(map(int,input().split()))
B=[]
C=0
for i in range(N):
    if A[i]%2==0:
        B.append(A[i])
for i in range(len(B)):
    if B[i]%3!=0 and B[i]%5!=0:
        C+=1
if C==0:
    print('APPRPVED')
if C!=0:
    print('DENIED')
N = int(input())
A = list(map(int,input().split()))
flag = 'APPROVED'
for a in A:
    print(a)
    if a % 2 == 0:
        if a % 3 != 0:
            if a % 5 != 0:
                flag = 'DENIED'
            break
print(flag)
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 = list(map(int, input().split()))
ans = []
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            ans.append(1)
        else:
            ans.append(-1)
if len(set(ans)) == 1 or len(set(ans)) == 0:
    print('APPROVED')
else:
    print('DENIED')
N = list(map(int, input().split()))
A = list(map(int, input().split()))

isApprove = True

for x in A:
    if x % 2 == 0:
        if (x % 3 != 0) or (x % 5 != 0):
            isApprove = False
            break
        
if isApprove:
    print ('APPROVED')
else:
    print('DENIED')
N = int(input())
A = list(map(int, input().split()))
for i in A:
    if (i%3==0 or i%5==0) and i%2==0:
        print('APPROVED')
    else:
        print('DENIED')
N = int(input())
A = list(map(int,input().split()))

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

if count == 0:
    print("DENIED")
else:
    print("APPROVED")
import sys
N=int(input())
A=list(map(int,input().split()))
flag=True
for i in range(N):
    if A[i]%2==0:
        if A[i]%3!=0 or A[i]%5!=0:
            flag=False
if flag==True:
    print('APPROVED')
else:
    print('DENIED')
n = int((input()))
a = list(map(int, input().split()))

f = False
for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            f = True
        else:
            f = False
            break
if f:
    print("APPROVED")
else:
    print("DENIED")
n = int(input())
a = list(map(int, input().split()))
judge = True
for i in range(n-1):
    if a[i]%2 == 0:
        if(a[i]%3 != 0 and a[i]%5 != 0):
            judge = False
            break
if judge:
    print('APPROVED')
else:
    print('DENIED')
n = input()
a = list(map(int, input().split()))

ok = 0
ng = 0
even = []
for i in a:
    if i % 2 == 0:
        even.append(i)

if len(even) == 0:
    print("DENIED")
    exit()

for i in even:
    if i % 3 != 0 and i % 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%3!=0 or i%5!=0:
      print("DENIED");exit()
print("APPROVED")
N=int(input())
A=list(map(int,input().split()))
def linersearch(N,A):
    for i in range(N):
        if A[i]%2==0:
            if A[i]%3==0 or A[i]%5==0:
                return "APPROVED"
            else:
                return "DENIED"
linersearch(N,A)
import sys

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

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

print ('APPROVED')
import sys
n = int(input())
a = list(map(int,input().split()))

for i in range(0,n-1):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            print("DENIED")
            sys.exit()
    
print("APPROVED")
list_ = [int(x) for x in input().split() if (int(x) % 2) == 0]
for f in list_:
    if (f % 3 == 0) or (f % 5 == 0):
        continue
    else:
        print("DENIED")
        break
else:
    print("APPROVED")
n=int(input())
l=list(map(int,input().split()))
print(l)
cnt=0
for i in range(n):
            if l[i]%2 !=0:
                        cnt+=1
if cnt==n:
            print('DENIED')
for i in range(n):
            if l[i]%2 ==0 and l[i]%3 !=0 and l[i]%5 !=0:
                        print('DENIED')
                        exit()
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 == 0:
    if count == N - 1:
        print('APPROVED')
        flag = 1
if flag == 0:
    print('DENIED')
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")
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"
    return "DENIED"
linersearch(N,A)
n = int(input())
a = [int(i) for i in input().split()]
f = True
for i in a:
    if i % 2:
        continue
    elif i % 3 != 0 or i % 5 != 0:
        f = False
        break

print('APPROVED' if f else 'DENIED')
n = int(input())
numbers = [int(x) for x in input().split()]
flag = 'APPROVED'
for number in numbers:
  if number % 3 == 0 or number % 5 == 0:
    continue
  else:
    flag = 'DENIED'
    break
print(flag)
n = int(input())
a = list(map(int, input().split()))
print("APPROVED" if all(i % 6 == 0 or i % 10 == 0 for i in a) else "DENIED")
s = int(input())

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

a = []
n = -1

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


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

if n != 0:
    exit()

if n == 0:
    print('APPROVED')
n = int(input())
 
numbers = list(map(int, input().split(' ')))
approved = False
 
for num in numbers[1::2]:
  if (num % 3 == 0) or (num % 5 == 0):
    approved = True
    continue
  else:
    approved = False
    print('DENIED')
    break
if approved:
  print('APPROVED')
n = int(input())
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]
for i in range(len(L)):
    if L[i]%3 == 0 or L[i]%5== 0:
        flag = True
    else:
        flag =False
        break
#print(L)
if len(L) == 0:
    print("DENIED")
    exit()
if flag:
    print("APPROVED")
else:
    print("DENIED")
def check(number):
    if number % 2 == 1:
        return True
    if number % 3 == 0 and number % 5 == 0:
        return True
    return False


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

flag = True

for num in array:
    if check(num) is False:
        flag = False
        break

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

A_even =list()

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

miss = True


for i in range(len(A_even)):
    if A_even[i]%3 == 0 or A_even[i]%5 == 0:
        pass
    else:
        miss = False
        break
if miss:
    print("DENIED")
else:
    print("APPROVED")
n = int(input())
a = list(map(int,input().split()))
for x in a:
    if not x % 2 and x % 3 and x % 5:
        print('DENIED')
        break
else:
    print('APROAVED')
n = int(input())
li = list(map(int,input().split()))
flag = 0
for i in range(n):
    if(li[i] % 2 == 0):
        if((li[i] % 3 == 0) or(li[i] % 5 == 0)):
            flag=1
        else:
            flag=0
            break
    else:
        flag=0
if(flag == 1):
    print('APPROVED')
else:
    print('DENIED')
n = int(input())
a = list(int(x) for x in input().split() if int(x)%2==0)
ok = True
for i in a:
  if i%3!=0 and i%5!=0:
    print('DENIED')
    ok = False
if ok:
  print('APPROVED')
inputs = map(int, input().split(" "))

is_denied = False
for i in inputs:
  if i % 2 ==0:
    if i % 3 != 0 and i % 5 != 0:
      is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")
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')

print('APPROVED')
N = int(input())
A = list(map(int, input().split()))
fl = True
for i in A:
    if i&1:
        continue
    else:
        if i%3!=0 or i%5!=0:
            fl = False
            break

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

count = 0
odd = 0

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

if count == len(A):
    print("DENIED")
else:
    print("APPROVED")
n=int(input())
a=map(int,input().split())

num = 0
for i in a:
  if i % 2 == 0:
    if i % 3 != 0 or i % 5 != 0:
      num='DENIED'
    else:
      num='APPROVED'
  else:
    num='DENIED'
print(num)
N = int(input())


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


data = read()
flag = True
for i in data:
    if (i % 2 == 0):
        if (i % 3 != 0 and i % 5 != 0):
            flag = False
            break
if (flag == True):
    print('APPROVED')
else:
    print('DEFINED')
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
  if A[i]%2 ==0 and (A[i]%3==0 or A[i]%5==0):
    print('APPROVED')
  else:
    print('DENIED')
    break
  break
N=int(input())

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

c=0

for i in s:
  if i%2==0:
    if i%3==0 or i%5==0:
      c=1
      break
    
if c==1:
  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
        else:
            count -=200
print("APPROVED" if count >=1  else "DENIED")
import sys
N = int(input())
p = 'DENIED'

for i in map(int, input().split()):
  print(i)
  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())
A = list(map(int, input().split()))

answer = 'DENIED'
for i in range(0, N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            answer = 'APPROVED'
        else:
            answer = 'DENIED'
            break

print(answer)
n = int(input())
L = list(map(int,input().split()))
L = [x for x in L if x%2 ==0]
for i in range(len(L)):
    if (L[i]%3 == 0 or L[i]%5== 0) and L[i]%15 != 0:
        flag = True
    else:
        flag =False
        break
#print(L)
if len(L) == 0:
    print("DENIED")
    exit()
if flag:
    print("APPROVED")
else:
    print("DENIED")
N = input()
A = map(int,(input().split()))

output = 'APPROVED'

for n in A:
    if (n % 2 == 0) and (n % 6 != 0) or (n % 10 != 0):
        output = 'DENIED'
        
print(output)
N = int(input())
A = list(map(int,input().split()))
res = False

for i in range(N):
  if A[i]%2 == 0:
    if A[i]%3 == 0 or A[i]%5 == 0:
      res = True
    else:
      res = False
if res:
  print("APPROVED")
else:
  print("DENIED")
N = int(input())
S = list(map(int,input().split()))
B= list()
X = list()
for i in S:
    if i % 2== 0:
        B.append(i)
for n in B:
    if n % 3 == 0 or n % 5 == 0:
        X.append(n)
if len(B) == len(X):
    print('APPROVE')
else:
    print('DENIED')
N=int(input())
S=[int(s) for s in input().split()]
for i in range(N):
    if S[i]%2==0 and S[i]%15!=0:
        print("DENIED")
    elif i==N-1:
        print("APPROVED")
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):
    print('DENIED')
else:
    print('APPROVED')