N = int(eval(input()))

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



for i in ints:

    if i % 2 == 0:

        if i % 3 != 0 and i % 5 != 0:

            print('DENIED')

            exit()



print('APPROVED')
N = eval(input())

ints = (i for i in map(int, input().split()) if i % 2 == 0)

ints = (i % 3 == 0 or i % 5 == 0 for i in ints)

print(('APPROVED' if all(ints) else 'DENIED'))
N = int(eval(input()))
ints = list(map(int, input().split()))
for i in ints:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

N = eval(input())
ints = (i for i in map(int, input().split()) if i % 2 == 0)
ints = (i % 3 == 0 or i % 5 == 0 for i in ints)
print(("APPROVED" if all(ints) else "DENIED"))

-N = int(eval(input())) -ints = list(map(int, input().split())) -for i in ints: -    if i % 2 == 0: -        if i % 3 != 0 and i % 5 != 0: -            print("DENIED") -            exit() -print("APPROVED") +N = eval(input()) +ints = (i for i in map(int, input().split()) if i % 2 == 0) +ints = (i % 3 == 0 or i % 5 == 0 for i in ints) +print(("APPROVED" if all(ints) else "DENIED"))