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):
def main():
  n = int(input())
  data = list(map(int, input().split()))

  for d in data:
    if d % 2 == 0:
      if d % 3 == 0 or d % 5 == 0:
        pass
      else:
        print("DENIED")
        return      
  
  print("APPROVED")


if __name__ == "__main__":
  main()

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

Solution (Python):


def main():
    *A, = map(int, open(0).read().split())
    N = A[0]
    A = A[1:]

    C = []
    B = [i for i in A if i % 2 == 0]
    for i in B:
        if (i % 3 == 0 or i % 5 == 0):
            C.append(0)
        else:
            C.append(1)
    
    if sum(C) == 0:
        print("APPROVED")
    else:
        print("DENIED")



main()

Solution (Python):
N=int(input())
flg=True
L=list(map(int,input().split()))

for i in range(N):
    if L[i]%2==0 and (L[i]%3!=0 and L[i]%5!=0):
        flg=False
        break
if flg:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
def main():
    N = int(input())
    sta = True
    A = [int(a) for a in input().split()]
    for i in range(N):
        if A[i] % 2 == 0:
            if A[i] % 3 == 0 or A[i] % 5 == 0:
                pass
            else:
                sta = False
    if sta:
        print("APPROVED")
    else:
        print("DENIED")
main()

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'
                break

    print(ans)

main()

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


def check(N,A):
    flg = True

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

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



            

N,A = nyu()
check(N,A)

Solution (Python):
import sys

N = int(input())
*A, = 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 = [int(x) for x in input().split()]
B = []
for i in A:
  if i%2 == 0:
    B.append(i)
count = 0
for j in B:
  if j%3 == 0 or j%5 == 0:
    count = count + 1
if count >= len(B):
  print("APPROVED")
else:
  print("DENIED")

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

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

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
List = []
judge = 0
for i in range(N):
    if A[i]%2 == 0:
        List.append(A[i])
i = 0
for i in range(len(List)):
    if List[i]%5 == 0 or List[i]%3 == 0:
        pass
    else:
        print('DENIED')
        judge += 1
        break

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

Solution (Python):
import sys
input = sys.stdin.readline

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

Solution (Python):
n=input()
a=map(int,raw_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()))
flg = True
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        else:
            flg = False
            break

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

print("APPROVED")

Solution (Python):



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

Answer = "APPROVED"
for i in set(a):
	if (i%2==1):
		continue
	elif(i%5==0 or i%3==0):
		continue
	else:
		Answer = "DENIED"
		break

print(Answer)

Solution (Python):
'''
INPUT SHORTCUTS
N, K = map(int,input().split())
N ,A,B = map(int,input().split())
string = str(input())
arr = list(map(int,input().split()))
N = int(input())
'''

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

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

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:
            continue
        else:
            flag = False
            break
    else:
        continue

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

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

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

def main():
    for n in nums:
        if n%2==0 and n%3!=0 and n%5!=0:
            print("DENIED")
            return
    print("APPROVED")
    return

if __name__ == "__main__":
    main()

Solution (Python):
n=input()
a=[int(i) for i in input().split() if int(i)%2==0]
print('APPROVED' if len([i for i in a if (i%3)*(i%5)!=0])<=0 else 'DENIED')

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

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

Solution (Python):
list_input_str = []
evenNumber = []
num = []
a = []

for i in range(2):
    s = input()
    if s:
        list_input_str.append(s)

if list_input_str:
    num = list_input_str[0]
    a = list_input_str[1].split(' ')

for i in range(int(num)):
    if int(a[i]) % 2 == 0:
        evenNumber.append(a[i])

if len(evenNumber) == 0:
    print('APPROVED')
else:
    for i in range(len(evenNumber)):
        if not (int(evenNumber[i]) % 3 == 0 or int(evenNumber[i]) % 5 == 0):
            print('DENIED')
            break
        else:
            if i == int(len(evenNumber)) - 1:
                print('APPROVED')

Solution (Python):
N=input()
ans=sum([ (a%2==0 and a%3*a%5 != 0) for a in map(int,input().split()) ])
print(('APPROVED','DENIED')[ans > 0])

Solution (Python):
N=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')
      break
else:
  print('APPROVED')

Solution (Python):
read = lambda: map(int, input().split())
n = int(input())
a = list(read())
print('APPROVED' if sum(i%3 and i%5 for i in a if i%2==0) ==0 else '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()))
for a in A:
    if a % 2 != 0:
        continue
    elif a % 3 == 0:
        continue
    elif a % 5 == 0:
        continue
    else:
        print("DENIED")
        exit()

print("APPROVED")

Solution (Python):
def main():
    n = int(input())
    A = list(map(int, input().split()))
    s = 0
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                s += 1
        else:
            s += 1
    if s == n:
        print("APPROVED")
    else:
        print("DENIED")


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
judge = True
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            judge = False
            break

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

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

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

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

Solution (Python):
n=input()
a=list(map(int,input().split()))
b=[]
c="DENIED"
d=[]

for i in a:
  if i%2 == 0:
    b.append(i)
    
for j in b:
  if j%3 == 0 or j%5 == 0:
    d.append(j)
    
if b == d:
  c = "APPROVED"

print(c)

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
b = []
c = []

for i in a:
    if i % 2 == 0:
        b.append(i)

for s in b:
    if s % 3 == 0 or s % 5 == 0:
        c.append(True)

if len(b) == len(c):
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):



import sys



class BufferedTokenizer:
    pass

def read_ints():
    return [int(token) for token in input().split()]

def read_tokens():
    return input().split()

def main():
    read_ints()
    approved = all(any(n % d == r for (d, r) in [(2, 1), (3, 0), (5, 0)])
                    for n in read_ints())
    print("APPROVED" if approved else "DENIED")

if __name__ == '__main__':
    main()

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

Solution (Python):
n= int(input())
lista=[]
listanova=[]
for x in input().split():
	x= int(x)
	if x %2 ==0:
		lista.append(x)
for x in lista:
	if x %3==0 or x%5==0:
		listanova.append(x)

if len(lista)==len(listanova):
	print('APPROVED')
else:
	print('DENIED')

Solution (Python):
n = int(input())
a = list(input().split())
evena = [s for s in a if int(s) % 2 == 0]
divide3or5 = [s for s in evena if (int(s) % 3 == 0) | (int(s) % 5 == 0)]
if len(evena) == len(divide3or5):
  print('APPROVED')
else:
  print('DENIED')

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

Solution (Python):


N = int(input())
A = 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"

print(ans)

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

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

print('APPROVED')

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

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

if(not flag):
  print('APPROVED')

Solution (Python):
def f(a):
    for i in a:
        if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
            print('DENIED')
            break
    else:
        print('APPROVED')

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

Solution (Python):
def f(a):
    for i in a:
        if i % 2 == 1:
            pass
        elif i % 2 == 0 and (i % 3 == 0 or i % 5 == 0):
            pass
        else:
            print('DENIED')
            break
    else:
        print('APPROVED')

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

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()))
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()))
count, check = 0, 0
for i in A:
    if i%2 == 0:
        count += 1
        if i%3 == 0 or i%5 == 0:
            check += 1
if count == check:
	print('APPROVED')
else:
	print('DENIED')

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

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
b=0
for v in a:
    if v%2==0 and v%3!=0 and v%5!=0:
        print("DENIED")
        break
    b+=1
if b==n:
    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):




def main():
    N = int(input())
    A = map(int, input().split())
    B = filter(lambda x: x%2==0, A)
    print('APPROVED' if all(map(lambda x: x%3==0 or x%5==0, B)) else 'DENIED')

if __name__ == '__main__':
    main()

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

Solution (Python):

def input1():
	return int(input())


def input2():
	return map(int,input().split())


def input_array():
	return list(map(int,input().split()))





N=input1()
A=input_array()
flag=True
for x in A:
	if x%2==0:
		if x%3==0 or x%5==0:
			continue
		else:
			flag=False
			break
if flag:
	print("APPROVED")
else:
	print("DENIED")

Solution (Python):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n = int(readline())
a = list(map(int, readline().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 a in A:
    if a%2==0:
        if a%3==0 or a%5==0:
            continue
        else:
            ans="DENIED"
    else:
        pass
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()))
lst = []
count = 0
for ele in A:
    if ele % 2 == 0:
        lst.append(ele)
for ele in lst:
    if ele % 3 == 0 or ele % 5 == 0:
        count += 1
print("APPROVED" if count == len(lst) else "DENIED")

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

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
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())
nums = list(map(int, input().split()))
res = True
for num in nums:
    if num % 2 == 0 and num % 3 != 0 and num % 5 != 0:
        res = False
if res:
    print('APPROVED')
else:
    print('DENIED')

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

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

s=0
for i in range(N):
    if num[i]%2==0 and num[i]%3!=0 and num[i]%5!=0:
        s += 1
if s>0:
    print('DENIED')
else:
    print('APPROVED')

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

ans = ""
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            ans = "APPROVED"
        else:
            ans = "DENIED"
            break
    else:
        ans = "APPROVED"
print(ans)

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
 
j = True
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()))
 
j = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] %3 == 0 or A[i] % 5 ==0:
            pass
        else:
            j = False
            
if j == True:
    print("APPROVED")
else:
    print("DENIED")

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

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

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 % 10 != 0:
            flag = 1
print("DENIED" if flag == 1 else "APPROVED")

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

for i in range(N):
    if A[i] % 2 == 1:
        A.remove(A[i])
        A.insert(i,0)
for i in range(len(A)):
    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()))

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
l=m=0
for i in range(n):
  if a[i]%2==0:
    l+=1
    if a[i]%3==0 or a[i]%5==0:
      m+=1
    else:
      print("DENIED")
      break    
if l==m:
  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())
List = [int(i) for i in input().split()]

for i in range(N):
  xx = int(List[i])
  if xx % 2 == 0:
    if (xx % 3 == 0 or xx % 5 == 0):
      pass
    else:
      print ("DENIED")
      exit()
  else:
    pass

print("APPROVED")

Solution (Python):
import sys

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

for i in range(n):
    tmp = int(a[i])
    if (tmp % 2 == 0) and (tmp%3 != 0 )and (tmp%5 !=0):
            print("DENIED")
            sys.exit()
print("APPROVED")

Solution (Python):
N = int(input())
A_list = list(map(int, input().split()))
even_list = []
n = 0
for i in range(N):
    if A_list[i] % 2 == 0:
        even_list.append(A_list[i])
        n += 1
m = 0
for j in range(n):
    if even_list[j] % 3 == 0 or even_list[j] % 5 == 0:
        m += 1
if n == m:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
a = map(int, input().split())
flag = True
for num in a:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            flag = False
            break
if flag == False:
    print("DENIED")
else:
    print("APPROVED")

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

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

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

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

print('APPROVED')

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

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

print(ans)

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

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

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

"""

n=int(input())
A=list(map(int,input().split()))
s="APPROVED"
for i in range(n):
    if(A[i]%2==0):
        if not (A[i]%3==0 or A[i]%5==0):
            s="DENIED"
            break
            
print(s)

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

Solution (Python):
N=int(input())
As=list(map(int, input().split()))
rejected=False
for A in As:
  if A%2==0:
    if A%3*(A%5)!=0:
      rejected=True
if rejected:
  print("DENIED")
else:
  print("APPROVED")

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

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

even = 0
bai = 0
for i in range(N):
    if A[i] % 2 == 0:
        even = even + 1
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            bai = bai + 1
    i = i + 1
    
if even == bai:
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
flag = True
for a in A:
    if(a%2==0 and (a%3!=0 and a%5!=0)):
        flag = False
        break
if(flag):
    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()))

flag=True
for i in range(N):
    if A[i]%2==0:
        if A[i]%3 and A[i]%5:
            flag=False
if flag:
    print('APPROVED')
else:
    print('DENIED')

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

b = [i % 2 == 0 and (i % 3 and i % 5) for i in a]

print('DENIED' if sum(b) else 'APPROVED')

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

Solution (Python):
n=int(input())
A=[int(_) for _ 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")
            break
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 or a[i] % 5 == 0:
      pass
    else:
      print("DENIED")
      exit()
print("APPROVED")

Solution (Python):
a = int(input())
nums = input().split()
flag = True
for i in range (a):
    x = int(nums[i])
    if (x % 2 == 0):
        if not (x % 3 == 0 or x % 5 == 0):
            flag = False
            break

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

Solution (Python):
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=map(int,stdin[1].split())
flag=True
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:
        flag=False
        break
print('APPROVED' if flag else 'DENIED')

Solution (Python):
stdin = open(0).read().split('\n')
N=int(stdin[0])
A=map(int,stdin[1].split())
flag=True
for a in A:
    if a%2==0 and a%3!=0 and a%5!=0:flag=False
print('APPROVED' if flag 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:
        if (A[i]%3 != 0) and (A[i]%5) != 0:
            flag = False

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

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

p=input().split()

for i in range(n):
    p[i]=int(p[i])

t=[]
q=0

for i in range(n):
    if p[i]%2==0:
        t.append(p[i])
        q=q+1

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

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

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

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

fl = True

for i in n :
    if (i % 2 == 0) :
        if (i % 3 != 0 and i % 5 != 0) :
            fl = False

print ('APPROVED' if fl else 'DENIED')

Solution (Python):
n = int (input ())
a = list (map (int, input ().split ()))
flag = True
for k in a:
    if (k & 1 == 0 and k % 3 != 0 and k % 5 != 0):
        flag = False

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

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

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

print("APPROVED")

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

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

count_even = 0
count_odd = 0
for i in range(0,len(a)):
    if a[i] % 2 == 0:
        count_even += 1
        if a[i] % 3 == 0 or a[i] % 5 == 0:
             count_odd += 1

if count_even == count_odd:
    print("APPROVED")
else:
    print("DENIED")

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

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

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

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

Solution (Python):
N=int(input())
a=[int(i) for i in input().split()]
for i in a:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue
        else:
            print('DENIED')
            exit()
print('APPROVED')

Solution (Python):
n = int(input())
a = [int(i) for i in input().split()]
flag = 1
for num in a:
    if num % 2 == 0:
        if (num % 3 == 0) or (num % 5 == 0):
            flag = 1
        else:
            flag = 0
            break
print('APPROVED') if flag else print('DENIED')

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

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