n = int(eval(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')

            exit()

print('APPROVED')

n = int(eval(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:

            continue

        else:

            print('DENIED')

            exit(0)

print('APPROVED')
n = int(eval(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")
            exit()
print("APPROVED")

n = int(eval(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:
            continue
        else:
            print("DENIED")
            exit(0)
print("APPROVED")

-        if a[i] % 3 != 0 and a[i] % 5 != 0: +        if a[i] % 3 == 0 or a[i] % 5 == 0: +            continue +        else: -            exit() +            exit(0)