n = int(eval(input()))

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

L = [x for x in L if x%2 ==0]



if all((L[i]%3 == 0 or L[i]%5 == 0 for i in range(len(L)))):



    print("APPROVED")

else:

    print("DENIED")
n = int(eval(input()))

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



for i in range(n):

    if L[i]%2 == 0:

        if L[i]%3 == 0 or L[i]%5== 0:

            continue

        else:

            print("DENIED")

            exit()



print("APPROVED")
n = int(eval(input()))
L = list(map(int, input().split()))
L = [x for x in L if x % 2 == 0]
if all((L[i] % 3 == 0 or L[i] % 5 == 0 for i in range(len(L)))):
    print("APPROVED")
else:
    print("DENIED")

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

-L = [x for x in L if x % 2 == 0] -if all((L[i] % 3 == 0 or L[i] % 5 == 0 for i in range(len(L)))): -    print("APPROVED") -else: -    print("DENIED") +for i in range(n): +    if L[i] % 2 == 0: +        if L[i] % 3 == 0 or L[i] % 5 == 0: +            continue +        else: +            print("DENIED") +            exit() +print("APPROVED")