n = int(eval(input()))

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

ret = 'APPROVED'

for a in A:

  if a % 2 == 1:

    continue

  if a % 3 == 0 or a % 5 == 0:

    continue

  ret = 'DENIED'

  break

print(ret)

n = int (eval(input ()))

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

flag = True

for k in a:

    if (k & 1 == 0 and k % 3 != 0 and k % 5 != 0):

        flag = False



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

n = int(eval(input()))
a = list(map(int, input().split()))
flag = True
for k in a:
    if k & 1 == 0 and k % 3 != 0 and k % 5 != 0:
        flag = False
print(("APPROVED" if flag else "DENIED"))

-A = list(map(int, input().split())) -ret = "APPROVED" -for a in A: -    if a % 2 == 1: -        continue -    if a % 3 == 0 or a % 5 == 0: -        continue -    ret = "DENIED" -    break -print(ret) +a = list(map(int, input().split())) +flag = True +for k in a: +    if k & 1 == 0 and k % 3 != 0 and k % 5 != 0: +        flag = False +print(("APPROVED" if flag else "DENIED"))