N = int(eval(input()))

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





i = 0



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:

            continue

    else:

        continue



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

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





i = 0



for i in range(len(A)):

    if (A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0)):

        continue

    else:

        print('DENIED')

        exit()





print('APPROVED')

N = int(eval(input()))
A = list(map(int, input().split()))
i = 0
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:
            continue
    else:
        continue
print("APPROVED")

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

-    if A[i] % 2 == 0: -        if A[i] % 3 != 0 and A[i] % 5 != 0: -            print("DENIED") -            exit() -        else: -            continue +    if A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0): +        continue -        continue +        print("DENIED") +        exit()