N = int(eval(input()))

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



B = list([x for x in A if x % 2 == 0])

C = list([(x % 5 == 0)or(x % 3 == 0) for x in B])



print((["APPROVED","DENIED"][False in C]))
eval(input())

print((["APPROVED","DENIED"]["1"in [format(0x28828228,'b')[int(x)%30-2] for x in input().split()]]))
N = int(eval(input()))
A = list(map(int, input().split()))
B = list([x for x in A if x % 2 == 0])
C = list([(x % 5 == 0) or (x % 3 == 0) for x in B])
print((["APPROVED", "DENIED"][False in C]))

eval(input())
print(
    (
        ["APPROVED", "DENIED"][
            "1" in [format(0x28828228, "b")[int(x) % 30 - 2] for x in input().split()]
        ]
    )
)

-N = int(eval(input())) -A = list(map(int, input().split())) -B = list([x for x in A if x % 2 == 0]) -C = list([(x % 5 == 0) or (x % 3 == 0) for x in B]) -print((["APPROVED", "DENIED"][False in C])) +eval(input()) +print( +    ( +        ["APPROVED", "DENIED"][ +            "1" in [format(0x28828228, "b")[int(x) % 30 - 2] for x in input().split()] +        ] +    ) +)