Problem:
 Score: 200 points    Problem Statement  You are an immigration officer in the Kingdom of AtCoder. The document carried by an immigrant has some number of integers written on it, and you need to check whether they meet certain criteria.  According to the regulation, the immigrant should be allowed entry to the kingdom if and only if the following condition is satisfied:   All even numbers written on the document are divisible by 3 or 5 .   If the immigrant should be allowed entry according to the regulation, output APPROVED ; otherwise, print DENIED .      Notes   The condition in the statement can be rephrased as "If x is an even number written on the document, x is divisible by 3 or 5 ".
Here " if " and " or " are logical terms.       Constraints   All values in input are integers.  1 \leq N \leq 100  1 \leq A_i \leq 1000         Input  Input is given from Standard Input in the following format:  N  A_1  A_2  \dots  A_N       Output  If the immigrant should be allowed entry according to the regulation, print APPROVED ; otherwise, print DENIED .        Sample Input 1 5
6 7 9 10 31      Sample Output 1 APPROVED  The even numbers written on the document are 6 and 10 .  All of them are divisible by 3 or 5 , so the immigrant should be allowed entry.       Sample Input 2 3
28 27 24      Sample Output 2 DENIED  28 violates the condition, so the immigrant should not be allowed entry.

Solution (Python):
n=int(input())
ans="APPROVED"
for i in list(map(int,input().split())):
  if i%2==0:
    if i%3!=0 and i%5!=0:ans="DENIED"
print(ans)

Solution (Python):
import sys
N = int(input())
A = [int(i) for i in input().split()]
for i in A:
  if i%2 == 0 and (not i%3 == 0 and not i % 5 == 0):
    print("DENIED")
    sys.exit()
  else :
    continue
print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
if all(i%2==1 or i%6==0 or i%10==0 for i in a):
    print('APPROVED')
else:
    print("DENIED")

Solution (Python):
import sys


def main():
    n = int(input())
    As = list(map(int, input().split()))
    for A in As:
        if A % 2 != 0:
            continue
        if A % 3 == 0 or A % 5 == 0:
            continue
        print("DENIED")
        sys.exit(0)
    print("APPROVED")


if __name__ == "__main__":
    main()

Solution (Python):
import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])

aa = a[a%2 == 0]
if np.all((aa%3 == 0) | (aa%5 == 0)):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import numpy as np

n = int(input())
a = np.array([int(x) for x in input().split()])

aa = a[a%2 == 0]
aaa = aa[(aa%3 == 0) | (aa%5 == 0)]

if len(aa) == len(aaa):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
Liste = [a for a in map(int,input().split()) if a % 2 == 0 and (a%3 != 0 and a%5 != 0)]
if len(Liste) == 0:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
ans = 'APPROVED'

N = int(input())
A = input().split()

for i in range(N):
    if (int(A[i])%2 == 0) and (int(A[i])%3 != 0) and (int(A[i])%5 != 0):
        ans = 'DENIED'
        break

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
for i in range(0, N):
    if A[i]%2 == 0:
        if A[i]%3 != 0 and A[i]%5 != 0:
            print ("DENIED")
            break
else:
    print ("APPROVED")

Solution (Python):
N = int(input())
li = [int(i) for i in input().split()]

is_approved = True
for l in li :
    if (l % 2 != 0) :
        continue

    if (l % 3 == 0 or l % 5 == 0) :
        continue

    is_approved = False
    break

if (is_approved) :
    print("APPROVED")
else :
    print("DENIED")

Solution (Python):
n = int(input())
for i in map(int,input().split()):
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      print('DENIED')
      exit()
print('APPROVED')

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]

a_even = []
for ai in a:
    if ai%2 == 0:
        a_even += [ai]

ans = "APPROVED"
for a_eveni in a_even:
    if a_eveni%3 != 0 and a_eveni%5 != 0:
        ans = "DENIED"
        break

print(ans)

Solution (Python):
n = int(input())
nlist = list(map(int,input().split()))

for i in range(0,n):
    if nlist[i]%2 == 1:
        nlist[i] = 3

ansn = 0

for i in range(0,n):
    if nlist[i]%3 == 0 or nlist[i]%5 == 0:
        ansn += 1

if ansn == n:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import sys

def main():
    N = sys.stdin.readline().rstrip('\n')
    line = sys.stdin.readline().rstrip('\n').split()

    for A in line:
        if int(A)%2 == 0:
            if not (int(A)%3==0 or int(A)%5==0):
                print('DENIED')
                return
    print('APPROVED')

main()

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
for a in A:
    if a%2 == 0 and ( a%3 != 0 and a%5 != 0 ):
        print('DENIED')
        exit()
print('APPROVED')

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
ans ="APPROVED"
for i in A:
    if i % 2 ==0:
        if i % 3 !=0 and i % 5 !=0:
            ans = "DENIED"
            break

print(ans)

Solution (Python):
def solve():
    N = int(input())
    A = list(map(int, input().split()))

    for num in A:
        if num % 2 == 0:
            if num % 3 != 0 and num % 5 != 0:
                print('DENIED')
                break
    else:
        print('APPROVED')

if __name__ == '__main__':
    solve()

Solution (Python):
n=int(input())
seq=input().split()
check=0
for i in range(n):
  if int(seq[i])%2==0:
    if int(seq[i])%3!=0 and int(seq[i])%5!=0:
      check+=1
if check==0:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = list((i for i in A if i % 2 == 0))
 
count = 0
 
for i in B:
    if i%3 == 0 or i%5 == 0:
        count += 1
 
if count == len(B):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))

for i in A:
    if i%2 == 0:
        if i%3 == 0 or i%5 == 0:
            continue
        else:
            print("DENIED")
            quit()


print("APPROVED")

Solution (Python):
N = int(input())

A = list(map(int, input().split()))
flag = False
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            flag = True


if flag:
    print('DENIED')
else:
    print('APPROVED')

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
flag = 1
for i in A:
    if i%2==0 and i%3!=0 and i%5!=0:
        flag = 0
        break
if flag==1:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
input()
a_list = map(int, input().split())

for a in a_list:
  if a%2 == 0:
    if a%3 * a%5 != 0:
      print("DENIED")
      exit()
print("APPROVED")

Solution (Python):
_ = int(input())
a = list(map(int, input().split()))
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
def resolve():
	import sys
	n = int(input())
	a = list(map(int, input().split()))
	for i in range(n):
		b = a[i]
		if b%2 ==0:
			if b%3 !=0 and b%5 !=0:
				print("DENIED")
				exit()
	print("APPROVED")
resolve()

Solution (Python):
import sys
n=int(input())
A=list(map(int,input().split()))
for a in A:
    if a%2==0:
        if a%3!=0 and a%5!=0:
            print("DENIED")
            sys.exit()
print("APPROVED")

Solution (Python):
N=int(input())
print('DENIED' if any([int(x)%2==0 and (int(x)%3 and int(x)%5) for x in input().split()]) else 'APPROVED')

Solution (Python):
n = int(input())

a = list(map(int,input().split()))
ans = 'APPROVED'
for i in a:
  if i%2 == 0:
    if i%3 != 0 and i%5 != 0:
      ans = 'DENIED'
print(ans)

Solution (Python):
N = int(input())
l = list(map(int,input().split()))
for n in range(N):
    if l[n] % 2 == 0:
        if l[n] % 3 == 0 or l[n] % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

result = 'APPROVED'
for a in A:
    if a % 2 == 1:
        continue
    if a % 3 == 0 or a % 5 == 0:
        continue
    result = 'DENIED'
    break
print(result)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans="APPROVED"
for i in range(n):
    if a[i]%2==0:
        if a[i]%3!=0 and a[i]%5!=0:
            ans="DENIED"
            break
print(ans)

Solution (Python):
n = int(input())
li = [int(x) for x in input().split()]
for i in li:
    if i%2 == 0:
        if (i%3==0 or i%5==0):
            continue
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):
import math
import sys


N = int(input())
Ax = list(map(int,input().split()))
for A in Ax:
    if A % 2 != 0:
        continue
    else:
        if A % 3 != 0 and A % 5 != 0:
            print("DENIED")
            exit(0)

print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
cnt = 0
flag = 0
for i in range(n):
    if a[i]%2==0:
        cnt += 1
        if a[i]%3==0 or a[i]%5==0:
            flag += 1
else:
    if cnt == flag:
        print('APPROVED')
    else:
        print('DENIED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
count = 0
for i in range(N):
    if A[i]%2 == 0:
        if A[i]%3 == 0 or A[i]%5 == 0:
            count += 1
        else:
            count += 0
    else:
        count += 1
if int(count) == N:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
for i in a:
    if(i%2==0 and i%3 and i%5):
        print("DENIED")
        exit(0)
print("APPROVED")

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
ans = 0

i = 0
while i < N:
  if a[i] % 2 == 0:
    if a[i] % 3 != 0 and a[i] % 5 != 0:
      ans = 1
  i += 1
      
if ans == 0:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
judge1 = 0
judge2 = 0
for i in range(n):
    if a[i] % 2==0:
        judge1+=1
        if a[i] % 3 == 0 or a[i] % 5 ==0:
            judge2+=1
        
if judge1 == judge2:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
a = map(int,input().split())
for l in a:
    if l % 2 ==0:
        if l % 3 == 0 or l % 5 == 0:
            continue
        else:
            print("DENIED")
            quit()
print("APPROVED")

Solution (Python):
n = int(input())
a = map(int, input().split())
for l in a:
  if l %2 == 0:
    if l % 3 ==0 or l %5==0:
      continue
    else:
      print('DENIED')
      quit()
print('APPROVED')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

p = 'APPROVED'
for i in a:
  if i % 2 == 0:
    if i % 3 != 0:
      if i % 5 != 0:
        print('DENIED')
        exit()
print(p)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))

ans = 'APPROVED'
for x in arr:
  if x % 2 == 0:
    if not (x % 3 == 0 or x % 5 == 0):
      ans = 'DENIED'

print(ans)

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
count = 0
cnt = 0
for j in l:
    if j % 2 == 0:
        count += 1
for i in l:
    if i % 6 == 0 or i % 10 == 0:
        cnt += 1
if cnt == count:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N= int(input())
A = [int(x) for x in input().split()]
for i in A:
  if i%2==0 and (i%3==0 or i%5==0):
    continue
  elif i%2==0 and (i%3!=0 or i%5!=0):
    print("DENIED")
    exit()
print("APPROVED")

Solution (Python):
n = int(input())

a = []
for x in input().split():
    a.append(int(x))
    
is_approved = True

for i in a:
    if i % 2 ==0:
        if (i % 3 !=0) and (i % 5 !=0):
            is_approved = False
            
if is_approved:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import sys
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    if A[i] % 2 == 0 and A[i] % 3 != 0 and A[i] % 5 != 0:
        print('DENIED')
        sys.exit()
print('APPROVED')

Solution (Python):
def k(x):
  x=int(x)
  if x%2==0:
    if (x%3==0 or x%5==0):
      return 1
    return 0
  return 1
n=int(input());l=list(map(k,input().split()))
if sum(l)==n:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

f = True
for a in A:
  if (a&1)==0:
    if ((a%3==0) or (a%5==0)):
      pass
    else:
      f = False

if f:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            print("DENIED")
            exit()

print("APPROVED")

Solution (Python):

N = int(input())
list = input().split(" ")


even =[]
for i in range(N):
    if int(list[i]) % 2 == 0:
        even.append(int(list[i]))

number = len(even)


last = []
for j in even:
    if (j % 3 == 0) or (j % 5 == 0):
        last.append(j)


if len(last) == len(even):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A = [A[i] for i in range(N) if A[i] % 2 == 0]
for j in range(len(A)):
    if A[j] % 3 == 0 or A[j] % 5 == 0:
        A[j] = True
    else:
        A[j] = False

if all(A):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
X = map(int,input().split())
def check():
    for i in X:
        if(i%2 == 0):
            if(i%3 == 0 or i%5 == 0):
                continue
            else:
                print("DENIED")
                return 0

        else:
            continue
    print("APPROVED")
check()

Solution (Python):
def main():
    n = int(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')
                return
    
    print('APPROVED')

if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
a_list = [int(x) for x in input().split(' ')]
a_list = list(filter(lambda x:x%2 == 0 and (x%3 != 0 and x%5 != 0), a_list))

if not a_list:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
_ = input()
A = list(int(i) for i in input().split())

approve = True
for x in A:
    if x%2 == 0 :
        if x%3!=0:
            if x%5!=0:
                approve = False

if approve ==True:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
a = "APPROVED"
for i in range(N):
    if(A[i] % 2 == 0 ):
        if(A[i] % 3 != 0 and A[i] % 5 != 0):
            a = "DENIED"
print(a)

Solution (Python):
n=input()
listA=list(map(int,input().split()))

flag="APPROVED"

for i in listA:
	if i % 2 ==0 and i % 3 != 0 and i % 5 != 0:
		flag="DENIED"

print(flag)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

s=1
for i in range(n):
    s=s*a[i]


if s%2==1:
    print("APPROVED")
    exit()

p=[]
for i in range(n):
    p.append(1)

z=0
for i in range(n):
    if a[i]%2==1:
        p[i]=0
    else:
        if a[i]%6==0:
            p[i]=0
        elif a[i]%10==0:
            p[i]=0
    z=z+p[i]

if z==0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

p=[]
for i in range(n):
    p.append(1)

z=0
for i in range(n):
    if a[i]%2==1:
        p[i]=0
    else:
        if a[i]%6==0:
            p[i]=0
        elif a[i]%10==0:
            p[i]=0
    z=z+p[i]

if z==0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n=int(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:
            pass
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

s=1
for i in range(n):
    s=s*a[i]


if s%2==1:
    print("APPROVED")
    exit()

p=[]
for i in range(n):
    p.append(1)

z=0
for i in range(n):
    if a[i]%2==1:
        p[i]=0
    else:
        if a[i]%6==0:
            p[i]=0
        elif a[i]%10==0:
            p[i]=0
    z=z+p[i]

if z==0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N=int(input())
A=list(map(int, input().split()))
B=0
for i in A:
	if i%2==0:
		if i%3==0 or i%5==0:
			B+=0
		else:
			B+=1
if B==0:
	print('APPROVED')
else:
	print('DENIED')

Solution (Python):
import sys

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

a_even = [i for i in a if i%2==0]

for x in a_even:
    if x%3==0 or x%5==0:
        pass
    else:
        print('DENIED')
        
        sys.exit()
print('APPROVED')

Solution (Python):
import sys
n=int(input())
a=map(int, input().split())
for i in a:
    if i%2==0 and i%3!=0 and i%5!=0:
        print("DENIED")
        sys.exit()

print("APPROVED")

Solution (Python):
N = int(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)

Solution (Python):
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def S(): return input().rstrip()

def main():
    N = I(); A = LI(); judge=True
    for i in A:
        if i%2==0:
            if i%3!=0 and i%5!=0:
                judge=False
    if judge:
        print('APPROVED')
    else:
        print('DENIED')
if __name__ == '__main__':
    main()

Solution (Python):
input();print("APPROVED" if all([n%3==0 or n%5==0 for n in map(int,input().split()) if not n%2]) else "DENIED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
f = True
for i in range(N):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
      f = False
if f:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
n = int(input())
a = tuple(map(int, input().split()))
cnt = len(list(filter(lambda x: x % 2 == 1 or (x % 3 == 0 or x % 5 == 0), a)))
ans = 'APPROVED' if cnt == n else 'DENIED'
print(ans)

Solution (Python):
import sys
import math


ans=0
a=int(input())
li= [int(x) for x in input().split()]
for i in range(a):
  if li[i]%2==1:
    continue;
  elif (li[i]%3==0 or li[i]%5==0):
    continue;
  else:
    ans=1
if ans==1:
  print("DENIED")
else:
  print("APPROVED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

flag = True
for i in range(N):
    if A[i]%2 == 0:
        if A[i]%3 != 0 and A[i]%5 != 0:
            flag = False

if flag:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n=int(input())
arr = list(map(int,input().split()))
ans="APPROVED"
for a in arr:
    if a%2==0:
        if a%3==0 or a%5==0:
            pass
        else:
            ans="DENIED"

print(ans)

Solution (Python):



def judge(info_list):
    result = 0
    info_list = info_list.split()
    for check in info_list:
        check = int(check)
        
        if check % 2 == 0:
            if (check % 3 != 0) and (check % 5 != 0) :
                result = 1
    
    return result

def main():
    info_num = int(input())
    info = input()
    answear = judge(info)
    
    if answear == 0:
        print("APPROVED")
    else:
        print("DENIED")
    

if __name__ == "__main__":
    main()

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
f=1
for i in range(n):
    if a[i]%2:
        continue
    else:
        if a[i]%3==0 or a[i]%5==0:
            continue
        else:
            f=0
if f:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
a=int(input())
b=list(map(int,input().split()))
count=0
for i in range (a):
 if b[i]%2==0 and b[i]%3!=0 and b[i]%5!=0:
  count=0
  break
 else:count=1
if count==1:
 print("APPROVED")
else: print("DENIED")

Solution (Python):
N = int(input())
nums = [int(x) for x in input().split()]

approved = True
for num in nums:
    if (num%2==0):
        if (num%3!=0 and num%5!=0):
            approved = False
            break

if(approved):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
temp = input()
a = list(map(int, input().split()))
is_approved = True
for i in a:
  if i % 2 != 0:
    continue
  else:
    if i % 3 != 0 and i % 5 != 0:
      is_approved = False
if is_approved:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
input()
A = map(int, input().split(" "))

r = "APPROVED"
for a in A:
  if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
    r = "DENIED"
    break
print(r)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
    if i%2==0 and i%3>0 and i%5>0:
        ans=1
        break

if ans==0:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
a=int(input())
b=list(map(int,input().split()))
count=0
for i in range (a):
 if b[i]%2==0 and b[i]%3!=0 and b[i]%5!=0:
  count=0
  break
 else:count=1
if count==1:
 print("APPROVED")
else: print("DENIED")

Solution (Python):
def f(n: int) -> bool:
    if n % 2 == 0:
        if n % 3 == 0 or n % 5 == 0:
            return True
        else:
            return False
    else:
        return True


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

if all(map(f, A)):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):

"""
Created on Tue Mar  3 23:44:02 2020

@author: Kanaru Sato
"""

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

deny = 0

for i in range(0,N):
    if A[i]%2 == 0 and (A[i]%3 != 0 and A[i]%5 != 0):
        deny = 1

if deny == 1:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
n = int(input())
aList = list(map(int, input().split()))
ans = True
for i in aList:
    if i % 2 == 0:
        if not(i % 3 == 0 or i % 5 == 0):
            ans = False
            break

print("APPROVED" if ans else "DENIED")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

for i in a:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            print('DENIED')
            exit()

print('APPROVED')

Solution (Python):
n = int(input())
a_n = list(map(int,input().split()))

even = []
for num in a_n:
	if num%2==0:
		even.append(num)	

ans = True
for num in even:
	if num%3!=0 and num%5!=0:
		ans = False
		break

if ans: print('APPROVED')
else: print('DENIED')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

ans = True
for x in a:
    if not x % 2 == 0 or (x % 3 == 0 or x % 5 == 0):
        pass
    else:
        ans = False

if ans:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):

import numpy as np

N = int(input())
A = list(map(int, input().split()))
A = np.array(A)

a_even = A[A%2==0]
bool1 = a_even%3 == 0
bool2 = a_even%5 == 0
bool3 = np.sum(bool1+bool2) == len(a_even)
if bool3:
    ans = 'APPROVED'
else:
    ans = 'DENIED'
print(ans)

Solution (Python):
n = int(input())
b = list(map(int,input().split()))
okcounter = 0
ngcounter = 0
for i in range(n):
  if b[i] % 2  == 0:
    if b[i] % 3 == 0 or b[i] % 5 == 0:
      okcounter += 1
    else:
      ngcounter += 1
      break
if ngcounter > 0:
  print("DENIED")
else:
  print("APPROVED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
for i in A:
    if i % 2 == 0:
        if not(i % 3 == 0 or i % 5 == 0):
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):
n = int(input())
a = list(map(int, input().split()))

for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            print("DENIED")
            exit()

print("APPROVED")

Solution (Python):


n = int(input())
a = list(map(int, input().split()))
isApproved = [False for _ in range(n)]

for i in range(len(a)):
    if a[i]%2 == 0:
        if (a[i]%3 == 0) or (a[i]%5 == 0):
            isApproved[i] = True
        else:
            isApproved[i] = False
    else:
        isApproved[i] = True

if all(isApproved):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
b=[]
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i %2==0:
    b.append(i)
cnt=0
for i in b:
  if i%3==0 or i%5==0:
    cnt+=1
if cnt==len(b):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
b=[]
n=int(input())
a=list(map(int,input().split()))
for i in a:
  if i %2==0:
    b.append(i)
cnt=0
for i in b:
  if i%3==0 or i%5==0:
    cnt+=1
if cnt==len(b):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
N=int(input())
A=list(map(int, input().split()))

check=True
for n in range(N):
    if A[n]%2==0:
        if not (A[n]%3==0 or A[n]%5==0):
            check=False
if check:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())

nums = [int(x) for x in stdin.readline().rstrip().split()]

for i in nums:
    if i % 2 == 0:
        if (i % 3 != 0) and (i % 5 != 0):
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

flag = 0

for i in A:
  if i%2==0 and (i%3 != 0 and i%5 != 0):
    flag = 1
    
if flag == 0:
  print("APPROVED")
  
else:
  print("DENIED")

Solution (Python):
N=int(input())
A=list(map(int, input().split()))
B=[]
for i in range (N):
    if A[i]%2==0:
        B.append(A[i])
count=0
for j in range(len(B)):
    if B[j]%3==0 or B[j]%5==0:
        count=count+1

if count==len(B):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):

import numpy as np

N = int(input())
A = [int(x) for x in input().split()]
a = np.array(A)


mask = np.logical_or.reduce( (a%6==0 , a%10==0, a%2==1) )
if mask.all() : 
    print("APPROVED")
else :
    print("DENIED")

Solution (Python):
N = int(input())
An = list(map(int,input().split()))
An_2 = []
for i in range(N):
    if An[i] % 2 == 0:
        An_2.append(An[i])
a = 0
for i in range(len(An_2)):
    if An_2[i] % 3 == 0 or An_2[i] % 5 ==0:
        a += 1
if a == len(An_2):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
def solve(string):
    n, *a = map(int, string.split())
    a = [_a % 2 == 1 or _a % 6 == 0 or _a % 10 == 0 for _a in a]
    return "APPROVED" if all(a) else "DENIED"


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
for i in A:
  if i % 2 == 0:
    if i % 3 == 0 or i % 5 == 0:
      continue
    else:
      print("DENIED")
      exit()
  else:
    continue
print("APPROVED")

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
error = 0
for i in range(n):
  if li[i]%2 == 0:
    if li[i]%3 == 0 or li[i]%5 == 0:
      pass
    else:
      error = 1
  else:
    pass
if error:
  print('DENIED')
else:
  print('APPROVED')

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
for i in range(len(A)):
    if A[i]%2==0 and (A[i]%3==0 or A[i]%5==0):
        A[i]=1
    elif A[i]%2!=0:
        A[i]=1
    else:
        A[i]=0
B=[1]*N
if A==B:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))

flg = True
for a in A:
  if a%2 > 0:
    continue
  if a%3 == 0 or a%5 == 0:
    continue
  flg = False
  break
  
print("APPROVED" if flg else "DENIED")

Solution (Python):
N = int(input())
A =[int(i) for i in input().split()]

flag = 0

for i in A:
  if i%2 == 0:
    if (i%3 == 0) |(i%5 == 0):
      pass
    else:
      flag+=1
  else:
    pass
if flag ==0:
  ans ="APPROVED"
else:
  ans ="DENIED"
print(ans)

Solution (Python):
import numpy as np

n = int(input())
a = map(int, input().split())

even = np.array(list(filter(lambda x: x%2==0, a)))
three = even % 3 == 0
five = even % 5 == 0

print('APPROVED' if all(three+five) else 'DENIED')

Solution (Python):
_ = map(int,input().split())
l1 = list(map(int,input().split()))

is_app = 1
for i in l1:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            is_app = 0
if is_app == 1:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
A = list(map(int, input().split()))

flag = True

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = False
            break

if flag:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n=input()
l=[int(i) for i in input().split() if int(i) % 2 == 0]
l2=[i for i in l if (i % 3 == 0)or(i % 5 ==0)]
print(["DENIED","APPROVED"][l==l2])

Solution (Python):
def is_approved(x):
    if x % 2 == 1:
        return True
    else:
        if x % 3 == 0 or x % 5 == 0:
            return True
        else:
            return False

n = int(input())
list_a = list(map(int, input().split()))

flag_app = True

for x in list_a:
    if is_approved(x) is False:
        flag_app = False

if flag_app is True:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N = int(input())
A = map(int,input().split())

ans = "APPROVED"

for i in A:
    if i % 2 != 0:
       continue
    if (i % 3 == 0) or (i % 5 == 0):
       continue
    ans = "DENIED"
    break
print(ans)

Solution (Python):

def main():
    N = int(input())
    A = list(map(int,input().split()))
    for i in A:
        if (i % 2)==0:
            if (i % 3)!=0 and (i % 5)!=0:
                print('DENIED')
                return
    print('APPROVED')

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
*a, = map(int, input().split())

*_a, = filter(lambda x: x%2 == 0, a)
*_a, = map(lambda x: x%3 == 0 or x%5 == 0, _a)
print("APPROVED" if all(_a) else "DENIED")

Solution (Python):
N = int(input())
A = list (map(int, input().split()))
m = len(A)
X = "APPROVED"
for i in range(0, m):
	if (A[i] % 2) == 0:
		if (A[i] % 3) != 0:
			if (A[i] % 5) != 0:
				X = "DENIED"
print(X)

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]

ans = 'APPROVED'

for a in A:
    if a%2==0:
        if a%3==0 or a%5==0:
            continue
        else:
            ans = 'DENIED'
            break
    else:
        continue

print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
Answer = "APPROVED"
for index, a in enumerate(A):
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      Answer = "DENIED"
print(Answer)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))

ans="APPROVED"

for i in range(n):
  if a[i]%2==0:
    if a[i]%3!=0 and a[i]%5!=0:
      ans="DENIED"
print(ans)

Solution (Python):
n = int(input())
num = [int(x) for x in input().split()]

for a in num:
    if a%2 == 0:
        if (a%3==0 or a%5==0):
            continue
        print("DENIED")
        break
else:
    print("APPROVED")

Solution (Python):
n = int(input())
List = list(map(int,input().split()))
k="APPROVED"
for s in List:
  if s%2==0 and s%3!=0 and s%5!=0:
    k="DENIED"
    break
print(k)

Solution (Python):
n = int(input())
List = list(map(int,input().split()))
k="APPROVED"
for s in List:
  if s%2==1:
    continue
  elif s%3==0 or s%5==0:
    continue
  else:
    k="DENIED"
    break
print(k)

Solution (Python):
import sys
N = int(input())
A = list(map(int,input().split()))

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0:
            continue
        elif A[i] % 5 == 0:
            continue
        else:
            print('DENIED')
            sys.exit()
print('APPROVED')