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):
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
ans = 0
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            ans += 1
if ans == 0:
    print('APPROVED') 
else:
    print('DENIED')

Solution (Python):

n = input() 
an = [int(x.strip()) for x in input().split(' ')]

count = 0
check = 0
for i in an:
  if i % 2 == 0:
    check += 1
    if i % 3 == 0 or i % 5 == 0:
      count += 1
if count == check or check == 0:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
n = input()
num = input().split()

tmp=[0]*int(n)
count=0

for i in range(int(n)) :
    l = int(num[i]) 
    if l % 2 == 0 :
        tmp[i]=1
        if l % 3 == 0 or l % 5 == 0 :
            count=count+1

if sum(tmp) == count :
    print('APPROVED')
else :
    print('DENIED')

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

a = [i for i in a if i%2==0]
a3 = [i%3!=0 for i in a]
a5 = [i%5!=0 for i in a]
if sum([1*(a3[i] and a5[i]) for i in range(len(a))])==0:
  print('APPROVED')
else:
  print('DENIED')

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

Solution (Python):
N=int(input())
s=input().strip().split()
for j in range (N):
  n=int(s[j])
  if n %2 ==0:
    if n % 3 != 0 and n % 5 != 0:
      print("DENIED")
      break
  if j==N-1:
    print("APPROVED")

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

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

flag = 0
for i in a:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            flag = 1

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

Solution (Python):
import sys

lines = [l for l in sys.stdin]
length = int(lines[0])
digits = lines[1].split(' ')
nums = [int(s) for s in digits]

flag = 'APPROVED'
for n in nums:
  if n % 2 != 0: continue
  if n % 3 != 0 and n % 5 != 0:
    flag = 'DENIED'
    
print(flag)

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

Solution (Python):
N = int(input())
Nx = input().split()
g = []
for x in Nx:
    x = int(x)
    if x % 2 == 0:
        g.append(x)
ans = 0
for i in g:
    if not i % 3 == 0:
        if not i % 5 == 0:
            ans = 1
            break
        else:
          continue
    else:
        continue
if ans == 1:
    print("DENIED")
else:
    print("APPROVED")

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

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

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

for i in range(N):
  if n[i]%2 == 0:
    
    if n[i]%3 != 0:
      if n[i]%5 != 0:
        FLG=0
   
if FLG == 0:
  ans = "DENIED"
else:
  ans = "APPROVED"

print(ans)

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

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

count = 0

for i in range(number):
    if array[i] % 2 == 0:
        if (array[i] % 3 != 0) & (array[i] % 5 != 0):
            count += 1

if count == 0:
    print('APPROVED')

else:
    print('DENIED')

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

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

Solution (Python):
N=int(input())
li=map(int,input().split())
a=0
for k in li:
  if k %2==0:
    if k%3==0 or k%5==0:
      continue
    else:
      a=1
      break
if a==0:
  print('APPROVED')
else:
  print('DENIED')

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

ret = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            ret = 'DENIED'

print(ret)

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

B = list()
for i in range(len(A)):
    if A[i] % 2 == 0:
        B.append(A[i])

C = 0
for i in range(len(B)):
        if (B[i] % 3 == 0) or (B[i] % 5 == 0):
            C += 1 
    
if len(B) == C:
    print("APPROVED")
else :
    print("DENIED")

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

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

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

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

a=list(map(int,input().split()))
b=0
for i in range(n):

    if a[i-1]%2==1:
        b=b+1
    elif a[i-1]%3==0 or a[i-1]%5==0:
        b=b+1
    
if b==n:
    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==1:
        B.append(0)
    elif A[i]%3==0:
        B.append(0)
    elif A[i]%5==0:
        B.append(0)
    else:
        B.append(1)

T = sum(B)

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

Solution (Python):
input()
f=1
for x in map(int,input().split()):
  if x%2==0 and x%3 and x%5:
    f=0
    break
if f:
  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:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      print("DENIED")
      sys.exit()

print("APPROVED")

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
even = []
ans = []
for i in li:
    if i % 2 == 0:
        even.append(i)
for j in even:
    if j % 3 == 0 or j % 5 == 0:
        ans.append(j)
if len(even) == len(ans):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import sys

def sol(a, n):
  for i in range(0, n):
    x = a[i]
    if x%2 == 0:
      if x%3 != 0 and x%5 != 0:
        return False
  return True

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

if sol(a, n) == True:
  print('APPROVED')
else:
  print('DENIED')

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

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):
			flag=1

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

Solution (Python):
n = int(input())
list = input().split()
flg=True
for i in list :
	i = int(i)
	if i%2==0 and not(i%3==0 or i%5==0):
		flg=False
		
if flg:
	print("APPROVED")
else:
	print("DENIED")

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

flg = True
for i in range(n):
    if lst[i]%2!=0:
        continue
    if lst[i]%3==0 or lst[i]%5==0:
        continue
    else:
        flg=False
        break
print('APPROVED' if flg else 'DENIED')

Solution (Python):

n=int(input())
a=list(map(int,input().split()))
res=True
for i in range(len(a)):
    if a[i]%2==0 and (a[i]%3!=0 and a[i]%5!=0):
        res=False
if res:
    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):
N = int(input())
A = list(map(int,input().split()))

even_list = [i for i in A if i % 2 == 0 ]
ans = 0
for j in even_list:
    if j % 3 == 0 or j % 5 == 0:
        continue
    else:
        ans += 1
if ans == 0:
    print('APPROVED')
else:
    print('DENIED')

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

Solution (Python):
import numpy as np

n = int(input())
a = np.array(list(map(int, input().split())))
a = a[a % 2 == 0]
if np.all((a % 3 == 0) | (a % 5 == 0)):
    print("APPROVED")
else:
    print("DENIED")

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

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

approved = True
for val in v:
	if (val % 2 == 0):
		if (val % 3 != 0 and val % 5 != 0):
			approved = False
			
if (approved):
	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())
a=input().split(" ")
s="APPROVED"

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

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

Solution (Python):
def ApproveOrDeny(number_list):
  for num in number_list:
    if num % 2 == 0:
      if num % 3 != 0 and num % 5 != 0:
        return 'DENIED'
  return 'APPROVED'
 
N = int(input())
number_list = list(map(int, input().split()))
print (ApproveOrDeny(number_list))

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

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

b = 0

for i in range(N):
  if a[i]%2 == 0:
    if a[i]%3 != 0:
      if a[i]%5 != 0:
        b = 1
        break

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

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 0
    print("APPROVED")
    return 0


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

Solution (Python):
import sys
n = int(input())
a_li = [int(w) for w in input().split()]

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

print("APPROVED")

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

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

    print("APPROVED")

main()

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


A2 = [a for a in A if a % 2 == 0]

A35 = [a for a in A2 if not(a%3 == 0 or a%5 == 0)]


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

Solution (Python):
def ok(n):
  if n%2==1:
    return True
  else:
  	return n%3==0 or n%5==0
n=int(input())
a=[ok(int(x)) for x in input().split()]
if False in a:
  print('DENIED')
else:
  print('APPROVED')

Solution (Python):
N = int(input())
A = list(int(x) for x in input().split())
found = True

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

if found:
    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 or a % 5 == 0:
      continue
    else:
      print("DENIED")
      break
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 or a[i]%5 == 0:
            pass
        else:
            flag = False
if flag:
    print("APPROVED")
else:
    print("DENIED")

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

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

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

for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            print('DENIED')
            app = False
            break

if app == True:
    print('APPROVED')

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

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
mod2 = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()
    for c in a:
        if c % 2 == 1:
            continue
        if c % 3 != 0 and c % 5 != 0:
            return "DENIED"

    return "APPROVED"


print(main())

Solution (Python):
N = int(input())
s = list(map(int, input().split()))
cond = True
for i in s:
  if i%2 == 0:
    if i%3 == 0 or i%5 == 0:
      continue
    else:
      cond = False
      break
if cond is True:
  print("APPROVED")
else:
  print("DENIED")

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

A = [int(e) for e in 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):
import sys

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

for num in number:
    if num % 2 == 0:
        if num % 3 !=0 and num % 5 != 0:
            print("DENIED")
            sys.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):
Num = int(input())
data = list(map(int, input().split()))
judge = 0
for i in range(Num):
    if data[i] % 2 == 0:
        if not((data[i] % 3 == 0) or (data[i] % 5 == 0)):
            print("DENIED")
            judge = 1
            break
if judge == 0:
    print("APPROVED")

Solution (Python):
n = int(input())
l = {int(i) for i in input().split() if int(i)%2 == 0}
cnt = 0
for i in l:
    if (i%3 == 0) or (i%5 == 0):
        pass
    else:
         cnt += 1
if cnt == 0:
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
a = [i for i in a if i%2==0]
a = [i for i in a if i%3!=0 and i%5!=0]
print('APPROVED' if len(a)==0 else '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):
_ = input()
A = map(int, input().split())

def f(n):
  if n % 2 == 1: return True
  return n % 3 == 0 or n % 5 == 0

if all(f(n) for n in A):
  print('APPROVED')
else:
  print('DENIED')

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

ans = []


for i in A:
    if (i % 2 == 0):
        ans.append(i)

lists = len(ans)

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

print("APPROVED")

Solution (Python):
n=int(input())
v=[int(x) for x in input().split(" ")]
ok=1
for x in v:
    if x%2==0:
        if x%3>0 and x%5>0:
            ok=0
if ok:
    print('APPROVED')
else:
    print('DENIED')

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

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

isApproved = True
for a in A:
    if (a % 3 != 0) and (a % 5 != 0) and (a % 2 == 0):
        isApproved = False

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

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

Solution (Python):
input()
paper_values = list(map(int, input().split()))
is_approved = True

for val in paper_values:
    if val % 2 != 0:
        continue

    if val % 3 == 0:
        continue

    if val % 5 == 0:
        continue

    is_approved = False

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

Solution (Python):
hoge = input()
ss = list(map(int,input().split()))
s = set(ss)
ninobaisu = {i * 2 for i in range(501)}
sannnobaisu = {i * 3 for i in range(334)}
gonobaisu = {i * 5 for i in range(201)}
intersection = s & ninobaisu
a = intersection - sannnobaisu
b = a - gonobaisu
if len(b) == 0:
  print("APPROVED")
else:
  print("DENIED")

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

Solution (Python):
n = int(input())
arr = []
arr = list(map(int, input().split()))
flag = 0
count = 0
for i in range(n):
  num = arr[i]
  if num % 2 == 0:
    count += 1
    if(num % 6 == 0) or (num % 10 == 0):
      flag += 1
      
if flag == count:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):

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

Solution (Python):
n=int(input())
a=[int(j) for j 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):
B = int(input())
N = list(map(int,input().split()))
A = 'APPROVED'
for i in range(len(N)):
  if  N[i] %2 ==0 :
    if N[i] % 3 != 0 and N[i] % 5 != 0:
      A = 'DENIED'
      break
    else:
      continue
print(A)

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

Solution (Python):
def main():
    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)

main()

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

flg = True

for x in a:
    if x % 2 != 0:
        continue
    if x % 3 != 0 and x % 5 != 0:
        flg = False

if flg:
    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())
A = list(map(int,input().split()))
ng = False
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      pass
    else:
      ng = True
if ng:
  print("DENIED")
else:
  print("APPROVED")

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

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


def ans(A):
    for a in A:
        if a % 2 == 0:
            if a%3 != 0 and a%5 != 0:
                return 'DENIED'

    return 'APPROVED'

print(ans(A))

Solution (Python):

import sys





def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    A = [int(next(tokens)) for _ in range(N)] 

    flg = True
    for _a in A:
        if _a%2==1 or _a%6==0 or _a%10==0:
            pass
        else:
            flg = False
            break

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

if __name__ == '__main__':
    main()

Solution (Python):
n = input()
data = raw_input()
res = True
for one in data.split():
  d = int(one)
  if d % 2 == 0:
    if (d % 3 != 0) and (d % 5 != 0):
      res = False
      break
if res:
  print("APPROVED")
else:
  print("DENIED")

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

for x in A:
    if x % 2 == 0:
        i += 1
        if (x % 3 == 0) or (x % 5 == 0):
            j += 1

if i == j:
    print("APPROVED")
    exit(0)
print("DENIED")

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

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

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))
chk = True
for i in nums:
    if i%2==0:
        if i%3==0 or i%5==0:
            pass
        else:
            chk = False
    else:
        pass
if chk == True:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):



N = int(input())
Array = list(map(int, input().split()))
tmp = 0

for i in range(N):
    tmp = Array[i]
    if tmp % 2 == 0:
        if tmp % 3 == 0 or tmp % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()
else:
    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')
      break
    elif i != N-1:
      continue
    else:
      print('APPROVED')
      break
  elif i != N-1:
    continue
  else:
    print('APPROVED')
    break

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

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

n=0

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

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

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

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

print("APPROVED")

Solution (Python):
n = int(input())
arr = []
arr = list(map(int, input().split()))
flag = 0
count = 0
for i in range(n):
  num = arr[i]
  if num % 2 == 0:
    count += 1
    if(num % 6 == 0) or (num % 10 == 0):
      flag += 1
      
if flag == count:
    print("APPROVED")
else:
    print("DENIED")

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


arr = list(map(int, input().split()))
den=0
app=0
for i in arr:
    i=int(i)
    if (i%2==0):
        if i%3==0 or i%5==0:
            app+=1
        else:
            den+=1
            break

if den>0:
  print("DENIED")
else:
  print("APPROVED")

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

for x in a:
    if x % 2 == 0:
        if x % 3 != 0 and x % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

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:
          continue
        else:
          print('DENIED')
          exit()

print('APPROVED')

Solution (Python):
N=int(input())
Ai=list(map(int,input().split()))
n=0
for i in Ai:
    if i%2==0:
        if i%3==0 or i%5==0:
            n+=1
        else:
            pass
    else:
        n+=1

if n==N:
    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 or a % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()

print("APPROVED")

Solution (Python):
N = int(input())
xs = map(int,input().split())
ans = "APPROVED"
for x in xs:
    if x%2 == 1 or x%3 == 0 or x%5 == 0:
        continue;
    ans ="DENIED"
print(ans)

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

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

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))
gu = [x for x in lst if x % 2 == 0]
con =  [x for x in gu if x % 3 == 0 or x % 5 == 0]
print('APPROVED' if gu == con else 'DENIED')

Solution (Python):
def solve(n, a):
    for i in range(n):
        if a[i] % 2 == 0:
            if not 0 in [a[i] % 3, a[i] % 5]:
                return "DENIED"
    return "APPROVED"

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

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

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

for i in papers:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            out = 1
            break

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

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

is_denied = False
for i in inputs:
  if i % 2 ==0 and ( i % 3 != 0 and i % 5 != 0):
      is_denied = True
      
if is_denied:
  print("DENIED")
else:
  print("APPROVED")

Solution (Python):
input()
a=input().split()
lis=[]
t=0
for i in a:
  lis.append(int(i))
for k in lis:
  if k%2==0:
    if k%5==0 or k%3==0:
      pass
    else:
      t=1
      break
  else:
    pass
if t==0:
  print("APPROVED")
elif t==1:
  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")
            break
else:
    print("APPROVED")

Solution (Python):
def main():
    _ = int(input())
    nums_list = list(map(int, input().split()))

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


if __name__ == '__main__':
    main()

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


if isend:
    print("DENIED")

else:
    print("APPROVED")

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

count = 0
for i in A:
    if i%2 == 0 and i%3 != 0 and i%5 != 0:
        print("DENIED")
        break
    count += 1

if count == len(A):
    print("APPROVED")

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

for i in a:
    if i % 2 == 0:
        if i % 3 and i % 5 :
            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!=0:
        a[i]=3
flag = True
for i in range(n):
    if a[i]%3==0 or a[i]%5==0:
        continue
    else:
        flag = False
if flag:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import sys
n = sys.stdin.readline()
a = list(map(int, sys.stdin.readline().split()))
ans = "APPROVED"
for i in a:
  if i%2==0:
    if i%3==0:
      continue
    elif i%5==0:
      continue
    else:
      ans = "DENIED"
print(ans)

Solution (Python):
N=int(input())
A=list(map(int, input().split())) 
tmp=[]
ans=True
for i in A:
  if i%2==0:
    tmp.append(i)
  else:
    continue

for i in tmp:
  if i%3==0 or i%5==0:
    continue
  else:
    ans=False
    
if ans:
  print("APPROVED")
else:
  print("DENIED")

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

count = 0
for i in range(n):
  if a[i] % 2 == 0:
    if a[i]%3==0 or a[i]%5==0:
      continue
    else:
      count += 1
      break
      
if count == 0:
  print("APPROVED")
else:
  print("DENIED")