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

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

for n in nums:
    if n % 2 != 0:
        continue

    if n % 3 == 0 or n % 5 == 0:
        continue
    else:
        print("DENIED")
        exit(0)

print("APPROVED")

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

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

even = []

for i in ai:
    if i%2 == 0:
        even.append(i)

ok = 0
for i in even:
    if i%3==0 or i%5==0:
        ok += 1

if len(even) == ok:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):


from typing import *
import collections
import functools
import itertools
import math
import sys

INF = float('inf')


def solve(N: int, A: "List[int]"):
    return ['DENIED', 'APPROVED'][all(a % 2 or a % 3 == 0 or a % 5 == 0 for a in A)]


def main():

    sys.setrecursionlimit(10 ** 6)

    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)]  
    print(f'{solve(N, A)}')


if __name__ == '__main__':
    main()

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

x=[]
ans=0
for i in a:
    if i%2==0 :
        x.append(i)
y=[]
for j in x:
    if j%3==0 or j%5==0:
        y.append(j)

if len(x)==len(y):
    print("APPROVED")
else:
    print("DENIED")

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

flag = True
for a_i in a:
    if a_i%2==0:
        if not (a_i%3==0 or a_i%5==0):
            flag=False

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
a = inpl()

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

print(ans)

Solution (Python):
input()
print('APPROVED' if all(map(lambda x: x % 3 == 0 or x % 5 == 0, filter(lambda x: x % 2 == 0, map(int, input().split())))) else 'DENIED')

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

if(ok):
  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=[int(i) for i in input().split()]
flag=0
for i in range(0,len(a)):
    if(a[i]%2==0 and (a[i]%3==0 or a[i]%5==0)):
        pass
    elif(a[i]%2==0 and (a[i]%3!=0 or a[i]%5!=0)):
        flag=1
        break
if(flag==1):
    print('DENIED')
else:
    print('APPROVED')

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

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

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

lst = []
for i in A:
    if i % 2 == 0:
        lst.append(i)
lst2 = []
if lst:
    for j in lst:
        if j % 3 == 0 or j % 5 == 0:
            lst2.append(j)
    if lst == lst2:
        print('APPROVED')
    else:
        print('DENIED')
else:
    print('APPROVED')

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
ans=0
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:
        ans=1
        break
print("ADPEPNRIOEVDE D"[ans::2])

Solution (Python):
n = int(input())
numlist = map(int, input().split())
numarr = list(numlist)
isevenList = [i for i in numarr if i % 2 == 0]
answerList = []
for i in isevenList:
    if i % 3 == 0 or i % 5 == 0:
        answerList.append("APPROVED")
    else:
        answerList.append("DENIED")
if "DENIED" in answerList:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
n = int(input())
q = list(map(int,input().split()))
ans = 0
count = 0
for i in q:
    if i%2 == 0:
        alm = i
        count += 1
        if alm%3 == 0 or alm%5 == 0:
            ans += 1
if ans == count:
    print("APPROVED")
else:
    print("DENIED")

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

a_list=[int(i) for i in input().split()]

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

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

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

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

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

for i in a:
    if i % 2 == 0:
        if i % 6 > 0 and i % 10 > 0:
            print('DENIED')
            exit()
print('APPROVED')

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

Solution (Python):


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

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

if all([B[j]%3==0 or B[j]%5==0  for j in range(len(B))]):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b=0
x=0
for i in range(n):
  if a[i]%2==0:
    x+=1
    if a[i]%3==0 or a[i]%5==0:
      b+=1
print('APPROVED' if b==x 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 and a[i]%3!=0 and a[i]%5!=0:
      b+=1
print('APPROVED' if b==0 else '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 or a[i] % 5 == 0):
            pass
        else:
            ans = "DENIED"
            break
print(ans)

Solution (Python):



















































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    N = int(lines[0])
    
    values = list(map(int, lines[1].split()))
    
    
    
    
    
    
    

    result = 'APPROVED'
    for n in range(N):
        if values[n] % 2 == 0:
            if values[n] % 3 != 0 and values[n] % 5 != 0:
                result = 'DENIED'

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['5', '6 7 9 10 31']
        lines_export = ['APPROVED']
    if pattern == 2:
        lines_input = ['3', '28 27 24']
        lines_export = ['DENIED']
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



if __name__ == '__main__':
    main()

Solution (Python):
n = input()

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

odd = [ c for c in l if (c % 2 == 0 ) and (( c % 3 != 0) and ( c % 5 !=0 ))]
if len( odd ) == 0: 
  print( "APPROVED" )
else:
  print( "DENIED" )

Solution (Python):
def papers_please():
    
    N = int(input())
    A = list(map(int, input().split()))
    
    for one_num in A:
        
        if one_num % 2 == 0:
            
            if one_num % 3 == 0 or one_num % 5 == 0:
                pass
            
            else:
                return 'DENIED'
        
        else:
            pass
    
    return 'APPROVED'

result = papers_please()
print(result)

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()))
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 == True:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
import numpy as np
stdin = open(0)

A = np.fromstring(stdin.read(), np.int64, sep=' ')[1:]
A = A[A % 2 == 0]
if np.all((A % 3 == 0) | (A % 5 == 0)):
    print('APPROVED')
else:
    print('DENIED')

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

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

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

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

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

num2=[]
for i in num:
    if i%2==0:
        num2.append(i)
num3=[]        
for j in num2:
    if j%3==0 or j%5==0:
        num3.append(0)
    elif j%3!=0 or j%5!=0:
        num3.append(1)

a=sum(num3)

if a==0:
    print("APPROVED")
elif a!=0:
    print("DENIED")

Solution (Python):
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

A = LI()

ans = True
for a in A:
    if a % 2 != 0:
        continue

    if a % 3 != 0 and a % 5 != 0:
        ans = False

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

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

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


if __name__ == '__main__':
    main()

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

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

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

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

flag = True

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

if flag:
    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:
            break
else:
    print("APPROVED")
    sys.exit()

print("DENIED")

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

if not ( 1 <= N <= 100 ): sys.exit()
if not ( 1 <= min(array) and max(array) <= 1000 ): sys.exit()

for I in array:
    if I % 2 == 0 and not ( I % 3 == 0 or I % 5 == 0 ):
        print('DENIED')
        sys.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) and ( i % 5 != 0):
             print('DENIED')
             exit()
print ('APPROVED')

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

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

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

is_approved = all([even_num % 3 == 0 or even_num % 5 == 0 for even_num in even_numbers])

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

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(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()))
res = 'APPROVED'
for x in a:
    if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
        res = 'DENIED'
print(res)

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

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

result = 'APPROVED'


        
for i in range(0,N):
  if a[i] %2 == 0:
     if (a[i] %3 != 0) and (a[i] %5 != 0):
        result ='DENIED'

        break
        
        
print (result)

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

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

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

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

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

Solution (Python):
_ = input()
A = [int(i) for i in input().split()]
result = {True: "APPROVED", False: "DENIED"}
print(result[all([a % 2 == 1 or (a % 3 == 0 or a % 5 == 0) for a in A])])

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

a = list(map(int, input().split()))
z = []
for i in a:
  if i % 2 == 0:
    z.append(i)


if all(j % 3 == 0 or j % 5 == 0 for j in z):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):

import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    A = LI()

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

    print("APPROVED")


main()

Solution (Python):
N = int(input())
A = [int(a) for a in 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()))
b=0
for x in A:
  if x%2==0:
    if x%3==0 or x%5==0:
      pass
    else:
      b=1
      break
if b==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 and a[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(0,N):
    if (A[i]%2)==0:
        if not ((A[i] % 3) == 0 or (A[i] % 5) == 0):
            ans = 'DENIED'
            break

print(ans)

Solution (Python):
n = list(map(int,input().split()))
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'
      break

print(ans)

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

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

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

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


for i in range(len(al)):
    if al[i] %2 == 0:
        bl.append(al[i])



for j in range(len(bl)):
    
    if bl[j] %3 == 0 or bl[j] %5 == 0:
        count += 1
    else:
        pass
    
print(['DENIED','APPROVED'][count == len(bl)])

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

Solution (Python):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
a = intl()

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
import math
import itertools as it
def I():return int(sys.stdin.readline().replace("\n",""))
def I2():return map(int,sys.stdin.readline().replace("\n","").split())
def S():return str(sys.stdin.readline().replace("\n",""))
def L():return list(sys.stdin.readline().replace("\n",""))
def Intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def Lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":
    n = I()
    a = Intl()
    for i in range(n):
        if a[i]%2 == 0:
            if a[i]%3 == 0 or a[i]%5 == 0:pass
            else:
                print("DENIED")
                exit()
    print("APPROVED")

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

for a in A:
    if a % 2 == 1:
        continue
    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 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()))

count = 0
ok = 0
for i in A:
    if i % 2 == 0:
        count += 1
        if i % 3 == 0 or i % 5 == 0:
            ok += 1

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

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

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

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

for i in num:
  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())
a = list(map(int, input().split()))

approved = True
for i in range(n):
    if a[i] % 2 == 0 and (a[i] % 3 != 0 and a[i] % 5 != 0):
        approved = False
        break
print("APPROVED" if approved else "DENIED")

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

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

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

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

t=1

for i in range(n):
    if a[i]%2==0 and a[i]%3==0:
        t=1
    elif a[i]%2==0 and a[i]%5==0:
        t=1
    elif a[i]%2==1:
        t=1
    else:
        t=0
        break 

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

Solution (Python):
input()
*l,=map(int,input().split())
print( len(set([1 for i in l if i%2==0 and (i%3!=0 and i%5!=0)]))*"DENIED" or 'APPROVED')

Solution (Python):
import sys
import itertools

import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines



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

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

Solution (Python):
import numpy as np
N = int(input())
a = np.array([a for a in map(int, input().split()) if a % 2 == 0])
b = (a % 3) * (a % 5)
print('APPROVED' if b.sum() == 0 else 'DENIED')

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

qual = all(v % 2 == 1 or (v % 3 == 0 or v % 5 == 0) for v in vals)

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

Solution (Python):

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

judge = True
for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            judge = False
            break

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

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

Solution (Python):


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

for Ai in A:
  if Ai % 2 == 1:
    continue
  else:
    if Ai % 3 != 0 and Ai % 5 != 0:
      print("DENIED")
      exit()

print("APPROVED")

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

for i in range(N):
  if A[i] % 2 != 0:
    continue
  if not (A[i]%3==0 or A[i]%5==0):
    x = False
if x:
  print("APPROVED")
else:
  print("DENIED")

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
a=[]
b=[]
for i in A:
    if i%2==0:
        a.append(i)
for n in a:
    if n%3==0 or n%5==0:
        b.append(n)
if len(a)==len(b):
    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] % 6 != 0 and A[i] % 10 != 0:
    ans = 'DENIED'
    break

print(ans)

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

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

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

Solution (Python):
n=int(input())
c=list(map(int, input().split()))
ans = 0
ans2 = 0

for i in c:
    if i%2 == 0:
        ans += 1
        if i%3 ==0 or i%5 == 0:
            ans2 += 1

if ans == ans2:
    print('APPROVED')
if ans != ans2:
    print('DENIED')

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

ans = 'APPROVED'
for a_i in a:
    if a_i % 2 == 0:
        if not ((a_i % 3 == 0) or (a_i % 5 == 0)):
            ans = 'DENIED' 
            break
print(ans)

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

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

Solution (Python):
def main():

    N = int(input())
    A = list(map(int, input().split()))
    even = [v for v in A if v % 2 == 0]
    if all((v % 3 == 0) or (v % 5 == 0) for v in even):
        return "APPROVED"
    return "DENIED"

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
if all(a[i]%2 or a[i]%3 == 0 or a[i]%5 == 0 for i in range(n)):
    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()))
count=0
for i in range(len(A)):
  if A[i]%2==0:
    if A[i]%3==0 or A[i]%5==0:
      count+=1
  else:
    count+=1
if count==len(A):
  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 = []
for i in range(n):
    if a[i] % 2 == 0:
        even_list.append(a[i])

x = 0
for m in range(len(even_list)):
    if even_list[m] % 3 == 0 or even_list[m] % 5 == 0:
        x += 1

if  x == len(even_list):
    print('APPROVED')

else:
    print('DENIED')

Solution (Python):
def main():
    N=int(input())
    A=list(map(int, input().split()))
    even=[i for i in A if i % 2 == 0]
    for i in even:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            print('DENIED')
            return
    print('APPROVED')
main()

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):
if __name__ == '__main__':

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

	cnt = 0
	for i in A:
		if i % 2 == 0:
			if i % 3 == 0 or i % 5 == 0:
				cnt += 1
		else:
			cnt += 1
	if cnt == n:
		print("APPROVED")
	else:
		print("DENIED")

Solution (Python):
def main():
    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:
                break
    else:
        print("APPROVED")
        return
    print("DENIED")


if __name__ == "__main__":
    main()

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

for j in b:
  if j % 3 != 0 and j % 5 != 0:
    print('DENIED')
    exit()
    
print('APPROVED')

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

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

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

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