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())
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
      if i == N-1:
        print('APPROVED')
      else:
        pass
    else:
      print('DENIED')
      break
  else:
    if i == N-1:
      print('APPROVED')
    else:
      pass

Solution (Python):
N=input()
A=input()
Alist=A.split()
counts=0
for i in Alist:
    if int(i)%2==1:
        counts=counts
    elif int(i)%3==0:
        counts=counts
    elif int(i)%5==0:
        counts=counts
    else:
        counts=counts+1
if counts>=1:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
N = input()

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

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

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

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

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())
a = list(map(int,input().split()))

a = [x for x in a if x % 2 == 0]
a = [x for x in a if x % 3 != 0 and x % 5 != 0]

if len(a) == 0:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    A = list(map(int, readline().split()))

    def judge():
        for x in A:
            if x % 2 == 0:
                if (x % 3 != 0) and (x % 5 != 0):
                    return False
        return True

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


if __name__ == '__main__':
    main()

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


i = 0

for i in range(len(A)):
    if (A[i] % 2 != 0 or (A[i] % 3 == 0 or A[i] % 5 == 0)):
        continue
    else:
        print('DENIED')
        exit()


print('APPROVED')

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


i = 0

for i in range(len(A)):
    if (A[i] % 2 == 0):
        if A[i] % 3 != 0 and A[i] % 5 != 0:
            print('DENIED')
            exit()
        else:
            continue
    else:
        continue

print('APPROVED')

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

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

for i in range(N):
    if A_list[i] % 2 == 0:
        if A_list[i] % 3 == 0 or A_list[i] % 5 == 0:
            continue
        else:
            print("DENIED")
            exit()

if i == N-1:
    print("APPROVED")

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 and a[i]%5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(n):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
     flag=1

if flag==0:
  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 and A[i] % 5 != 0):
            count += 1

if(count >= 1):
    print("DENIED")
else:
    print("APPROVED")

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

if i==0:
    print("APPROVED")

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())
S=[int(s) for s in input().split()]
for i in range(N):
    if S[i]%2==0 and S[i]%5!=0 and S[i]%3!=0:
        print("DENIED")
        break
    elif i==N-1:
        print("APPROVED")

Solution (Python):


num = int(input())
number = input().split()
count, count2 = 0, 0
table = list(number)
for i in number:
    if int(i) % 2 == 0:
        count += 1
        if int(i) % 3 == 0 or int(i) % 5 == 0:
            count2 += 1

if count == count2:
    print("APPROVED")
else:
    print("DENIED")

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

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

flag = 0
for i in range(N):
	if A[i] % 2 ==0:
		if (A[i] % 3 !=0) and (A[i] % 5 !=0):
			flag = 1
if flag == 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:
            continue
        else:
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):

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

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

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

def even(num, l):
    if num % 2 == 0:
        l.append(num)
        
B = []
for num in A:
    even(num, B)
    
C = []
for nn in B:
  if nn % 3 != 0 and nn % 5 != 0:
    C.append(nn)
    
if len(C) == 0:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
n = int(input())
a = list(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):


import sys
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")
            sys.exit()
print("APPROVED")

Solution (Python):
n = int(input())
x = list(map(int,input().split()))
for i in x:
  if i%2==0:
    if i%6!=0:
      if i%10!=0:
        print("DENIED")
        exit()
print("APPROVED")

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) or (a%5 == 0):
      pass
    else:
      print("DENIED")
      sys.exit()
print("APPROVED")

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])

cnt=0
for i in range(len(B)):
    if B[i]%3==0 or B[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()))
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')

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

Solution (Python):
def main():
    n = int(input())
    a_lst = list(map(int, input().split()))
    is_ok = True

    for a in a_lst:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                is_ok = False

    if is_ok:
        ans = "APPROVED"
    else:
        ans = "DENIED"

    print(ans)


if __name__ == "__main__":
    main()

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

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

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

X = [x for x in N_List if x % 2 ==0]
Y = [y for y in X if y % 3 ==0 or y % 5 ==0]

if len(X) == len(Y):
    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!=0 and i%5!=0:
        print('DENIED')
        exit()

print('APPROVED')

Solution (Python):
import sys

n=int(input())
a=[int(x) for x in 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 main():
    n = int(input())
    A = [int(x) for x in input().split()]
    flag = True
    for a in A:
        if a % 2 != 0:
            continue
        else:
            if a % 3 != 0 and a % 5 != 0:
                flag = False
    if flag:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == '__main__':
    main()

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

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

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

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 and A[i]%5!=0:
            print('DENIED')
            exit()

print('APPROVED')

Solution (Python):
import sys

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')
        sys.exit()
print('APPROVED')

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

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

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

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

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

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

c = 0

for i in range(N):
  if A[i]%2 == 0:
    if A[i]%6 ==0 and A[i]%10 != 0:
      c = c
    elif A[i]%6 !=0 and A[i]%10 == 0:
      c = c
    elif A[i]%6 ==0 and A[i]%10 == 0:
      c = c
    else:
      c += 1

if c >0:
  print('DENIED')
  
elif c == 0:
  print('APPROVED')

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

cnt = 0
l = []
for i in A:
    if i % 2 == 0:
        l.append(i)
        cnt += 1

ans = 0
for i in l:
    if i % 3 == 0 or i % 5 == 0:
        ans += 1

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

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

ans = 'APPROVED'

for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            ans = 'DENIED'
            break
print(ans)

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

Solution (Python):
n = int(input())
m = map(int, input().split())
flag = "APPROVED"

for i in m:
	if i % 2 == 0:
		if i % 3 != 0 and i % 5 != 0:
			flag = "DENIED"
    
print(flag)

Solution (Python):
N = int(input().rstrip())
l = [int(v) for v in input().rstrip().split()]
r = 'APPROVED'
for v in l:
    if v % 2 == 1:
        continue

    if v % 3 == 0 or v % 5 == 0:
        pass
    else:
        r = 'DENIED'
        break
        
print(r)

Solution (Python):
a = int(input())
b = input().split()
c = "APPROVED"
for i in range(a):
    if int(b[i]) % 2 == 0:
        if int(b[i]) % 3 == 0 or int(b[i]) % 5 == 0:
            c = "APPROVED"
        else:
            c = "DENIED"
            break
print(c)

Solution (Python):
def main():

    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):
            return "DENIED"
    return "APPROVED"

if __name__ == '__main__':
    print(main())

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

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

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

gu = []
ans = []

for i in range(N):
    if A[i] % 2 == 0:
        gu.append(A[i])
    else:
        pass

for j in range(len(gu)):
    if gu[j] % 3 == 0 or gu[j] % 5 == 0:
        ans.append(gu[j])
    else:
        pass

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

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

for num in a:
    if num % 2 == 0:
        if num%3==0 or num%5==0:
            pass
        else:
            print('DENIED')
            exit()

print('APPROVED')

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

even = [i for i in a if i % 2 == 0]
for check in even:
  if check % 3 != 0 and check % 5 != 0:
    print('DENIED')
    exit()
print('APPROVED')

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 and a[i] % 5 != 0:
            print("DENIED")
            exit()
print("APPROVED")

Solution (Python):
n=int(input())
a=[int(x) for x in input().split()]
b=[y for y in a if y%2 == 0]
c=0
for i in b:
    if i%3 == 0 or i%5 == 0:
        pass
    else:
        print("DENIED")
        c=1
        break
        
if c==0:
    print("APPROVED")

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

for a in A:
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      check = False

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

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

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

kotae='APPROVED'
for i in range(len(x)):
    if x[i]%2==0:
        if x[i]%3==0 or x[i]%5==0:
            pass
        else:
            kotae='DENIED'


print(kotae)

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

res = True

for num in A:
    if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
        res = False
        break

print(['DENIED', 'APPROVED'][res])

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

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

cntall = 0
cnt = 0

for i in a:
    if not(i & 1):
        cntall += 1
        if (i%5==0) or (i%3==0):
            cnt += 1
            
if cntall == cnt:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
c = 0
for i in l:
  if i%2 == 0:
    if i%3 != 0 and i%5 != 0:
      c += 1
      break
print("DENIED" if c > 0 else "APPROVED")

Solution (Python):
N = int(input())
lst = list(map(int, input().split()))
c = True
for i in lst:
    if i%2 ==0:
        if i%3 != 0 and i%5 != 0:
            c = False
            break
    
if c:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
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')
      exit()
print('APPROVED')

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

Solution (Python):
n = int(input())
a = map(int,input().split())
ans = "APPROVED"

for i in a:
  if i%2 == 0:
    if not(i%3==0 or i%5==0):
      ans = "DENIED"

print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in 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())
a = list(map(int, input().split()))
ans = 0
ant = 0
b = []
for i in range(n):
    if a[i] % 2 == 0:
        ant += 1
        b.append(int(a[i]))
        if a[i] % 3 == 0:
            ans += 1
        elif a[i] % 5 == 0:
            ans += 1

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

Solution (Python):

from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

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


def main():
    solve()


if __name__ == '__main__':
    main()

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

Solution (Python):
N=int(input())
list1=[]
list2=[]
for i in map(int,input().split()):
    if i % 2 == 0:
        list1.append(i)
    if i % 2 == 0 and (i % 3 == 0 or i % 5 ==0):
        list2.append(i)
if list1 == list2:
    print('APPROVED')
else:
    print('DENIED')

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
x = "APPROVED"
for i in range(n):
    if a[i] == (2 * int(a[i] / 2)):
        if a[i] != (3 * int(a[i] / 3)):
            if a[i] != (5 * int(a[i] / 5)):
                x = "DENIED"
print(str(x))

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

l = []
for a in A:
    if a % 2 == 0:
        l.append(a)

if all([i % 3 ==0 or i % 5 ==0 for i in l]):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):

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

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

Solution (Python):
def main():
    n = int(input())
    s = list(map(int,input().strip().split()))
    e = []
    for ss in s:
        if ss % 2 == 0:
            e.append(ss)
    
    for ee in e:
        if ee % 3 == 0 or ee % 5 == 0:
            continue
        else:
            print("DENIED")
            return
    
    print("APPROVED")
    return

main()

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())
a = list(map(int, input().split()))

ans = "APPROVED"
for x in a:
  if (x % 2 == 0):
    if (x % 3 != 0 and x % 5 != 0):
      ans = "DENIED"
print(ans)

Solution (Python):
from sys import stdin 

def main():
    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 or a[i] % 5 == 0:
                flag = True
            else:
                flag = False
                break
    if flag:
        print('APPROVED')
    else:
        print('DENIED')

if __name__ == "__main__":
    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 = list(int(x) for x in input().split() if int(x)%2==0)
ok = True
for i in a:
  if i%3!=0 and i%5!=0:
    print('DENIED')
    ok = False
    break
if ok:
  print('APPROVED')

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

l=[]
flag=0
for aa in a:
  if aa%2==0:
    flag=1
    l.append(aa)

if flag==1:   
  for ll in l:
    if ll % 3!=0 and ll % 5!=0:
	    flag=2

if flag==0:
  print('APPROVED')
elif flag==1:
  print('APPROVED')
elif flag==2:
  print('DENIED')

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
flag=True
li=[]
for i in range(len(l)):
  if l[i]%2==0:
    li.append(l[i])
for i in range(len(li)):
  if li[i]%3!=0 and li[i]%5!=0:
    flag=False

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

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

ans = "APPROVED"

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
for a in A:
    if a%2==0 and not (a%3==0 or a%5==0):
        print("DENIED")
        exit()
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:
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

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

if '__main__' == __name__:
    resolve()

Solution (Python):

N = int(input())
A = list(map(int, input().split()))
ans = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if (a % 3 != 0) & (a % 5 != 0):
            ans = 'DENIED'
            break
        else:
            continue
    else:
        continue
print(ans)

Solution (Python):
import sys

S = int(next(sys.stdin))
A = map(int, next(sys.stdin).strip().split())
even_numbers = filter(lambda y: not y % 2, A)
print('APPROVED' if all(not v % 3 or not v % 5 for v in even_numbers) else 'DENIED')

Solution (Python):
N = int(input())
anser = 'APPROVED'
A_list = list(map(int, input().split()))
for A in A_list:
    if A % 2 == 1:
        continue
    if A % 3 == 0:
        continue
    if A % 5 == 0:
        continue
    anser = 'DENIED'
    break
print(anser)

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

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

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

Solution (Python):
import numpy as np

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

a = np.array(A)

odd = a[a%2 == 0]

if np.sum((odd%3 != 0)&(odd%5 != 0)) == 0:
    print('APPROVED')
else:
    print('DENIED')

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):
import sys

input()
numbers = map(int, input().split())
evens = [number for number in numbers if number % 2 == 0]

if len(evens) == 0:
    print('APPROVED')
    sys.exit()
    
for even in evens:
    if even % 3 != 0 and even % 5 != 0:
        print('DENIED')
        sys.exit()

print('APPROVED')

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

for n in range(N):
    if A[n] % 2 == 1:
        pass
    elif A[n] % 3 == 0:
        pass
    elif A[n] % 5 == 0:
        pass
    else:
        ans = "DENIED"
        break
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
a = True
for x in A:
	if x % 2 == 0:
		if x % 3 != 0 and x % 5 != 0:
			a = False
			break
if a:
	print('APPROVED')
else:
	print('DENIED')

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

for i in a:
    if i % 2 ==  0 and i % 3 != 0 and i % 5 != 0:
        ans = 'DENIED'
        break

print(ans)

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

for i in a:
    if i % 2 ==  0 and i % 3 != 0 and i % 5 != 0:
        ans = 'DENIED'
        break

print(ans)

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

Solution (Python):
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')
            exit(0)
print('APPROVED')

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

Solution (Python):
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]
    is_approved = True
    for num in A:
        if num % 2 == 0:
            if not (num % 3 == 0 or num % 5 == 0):
                is_approved = False
    if is_approved:
        print("APPROVED")
    else:
        print("DENIED")

if __name__ == "__main__":
    solve()

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

a = [i for i in a if i%2==0]
a2 = [i for i in a if i%3==0 or i%5==0]

print("APPROVED" if a==a2 else "DENIED")

Solution (Python):
N = int(input())
A = list(map(lambda x: int(x), input().split(" ")))
B = list(filter(lambda y: y % 2 == 0 and y % 3 != 0 and y % 5 != 0, A))
print("DENIED") if len(B) > 0 else print("APPROVED")

Solution (Python):
import sys


def solve(a_list):
    for a in a_list:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                return False
    return True


def main():
    input = sys.stdin.buffer.readline
    _ = int(input())
    a_list = list(map(int, input().split()))
    print("APPROVED" if solve(a_list) else "DENIED")


if __name__ == "__main__":
    main()

Solution (Python):
MM = int(input())
AA = input().split()
count = 0
for j in AA:
  i = int(j)
  if i%2 ==0:
    if i%3 !=0 and i%5 !=0:
      count +=1
if count == 0:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
N = input()
A_ls = map(int, input().split(' '))
A_ls = [i for i in A_ls if i % 2 == 0]
ls = [i for i in A_ls if i % 3 == 0 or i % 5 == 0]
if len(A_ls) == len(ls):
    print('APPROVED')
else:
    print('DENIED')

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

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

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

Solution (Python):
N = int(input())
A = list(map(int,input().split(" ")))
B = ["APPROVED","DENIED"]
t = 0

for i in A:
  if i%2 == 0:
    if i%3 != 0 and i%5 != 0:
      t = 1
      break
print(B[t])

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

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

flg=True
for i in A:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            flg=False
            break
    else:
        pass

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
l_odd = []
count = 0

for i in range(n):
  if l[i] % 2 == 0:
    l_odd.append(l[i])
    
for i in range(len(l_odd)):
  if l_odd[i] % 3 == 0 or l_odd[i] % 5 == 0:
    count += 1
if count == len(l_odd):
  print("APPROVED")
else:
  print("DENIED")

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

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