n = int(eval(input()))

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



ans = "APPROVED"

for _a in a:

    if _a%2 == 0 and _a%3 != 0 and _a%5 != 0:

        ans = "DENIED"

        break

print(ans)

n = int(eval(input()))

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



*_a, = [x for x in a if x%2 == 0]

*_a, = [x%3 == 0 or x%5 == 0 for x in _a]

print(("APPROVED" if all(_a) else "DENIED"))



n = int(eval(input()))
(*a,) = list(map(int, input().split()))
ans = "APPROVED"
for _a in a:
    if _a % 2 == 0 and _a % 3 != 0 and _a % 5 != 0:
        ans = "DENIED"
        break
print(ans)

n = int(eval(input()))
(*a,) = list(map(int, input().split()))
(*_a,) = [x for x in a if x % 2 == 0]
(*_a,) = [x % 3 == 0 or x % 5 == 0 for x in _a]
print(("APPROVED" if all(_a) else "DENIED"))

-ans = "APPROVED" -for _a in a: -    if _a % 2 == 0 and _a % 3 != 0 and _a % 5 != 0: -        ans = "DENIED" -        break -print(ans) +(*_a,) = [x for x in a if x % 2 == 0] +(*_a,) = [x % 3 == 0 or x % 5 == 0 for x in _a] +print(("APPROVED" if all(_a) else "DENIED"))