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

OK = 'APPROVED'
NG = 'DENIED'


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = int(sys.stdin.buffer.readline().rstrip())
    A = list(map(int, sys.stdin.buffer.readline().split()))

    ret = OK
    for a in A:
        if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
            ret = NG

    print(ret)


if __name__ == '__main__':
    main()

Solution (Python):
'''input
3
28 27 24
'''
n = input()
a = map(int, input().split())

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

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

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
for j, i in enumerate(a):
    if (i % 2 == 0) and (not (i % 3 == 0 or i % 5 == 0)):
        print('DENIED')
        break
    if j == N - 1:
        print('APPROVED')

Solution (Python):
n = int(input())
a = (int(x) for x in input().split())
count2 = 0
count = 0
for num in a:
    if (num % 2) == 0:
        count2 += 1
        if (num % 3) == 0 or (num % 5) == 0:
            count += 1

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

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

isapp = [ i % 2 == 1 or i % 6 == 0 or i % 10 == 0 for i in nums]
if(all(isapp)):
  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()))

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())
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):
A=input().split()
x = input().split()
target ="APPROVED"
for i in x:
  if int(i)%2 == 0:
    if int(i)%3 > 0 and int(i)%5 > 0:
      target = "DENIED"
      break
print(target)

Solution (Python):
N=input().split()
LIST=input().split()
FLUG=0

for num in LIST:
  if int(num)%2==0 and int(num)%3!=0 and int(num)%5!=0 :
    FLUG=1

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

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

Solution (Python):
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  

n = ni()
a = na()
flag = True
for x in a:
    if x % 2 == 1:
        continue
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
            continue
        else:
            flag = False
if flag:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
def papers_please(a_list:list) -> str:
    approved_list = []      
    for x in a_list:
        if x % 2 == 0:
            if x % 3 == 0 or x % 5 == 0:
                approved_list.append("APPROVED")
            else:
                approved_list.append("DENIED")
        else:
            approved_list.append("APPROVED")
    if "DENIED" in approved_list:
        return("DENIED")
    else:
        return("APPROVED")

n = int(input())
a_list = list(map(int, input().split()))
print(papers_please(a_list))

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

immigre = 'APPROVED'
for num in list:
  if num % 2 == 0:
    if (num % 3 != 0) and (num % 5 != 0):
      immigre = 'DENIED'
print(immigre)

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

for i in range(N):
    if A[i]%2 == 0:
        if not (A[i]%3 == 0 or A[i]%5 == 0):
            bool = False
            break

if bool == True:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
A_list = []
ans = 0

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

for n in range(N):
    if (int(A_list[n]) % 2 == 0):
        if (int(A_list[n]) % 3 == 0) | (int(A_list[n]) % 5 == 0):
            ans = ans + 0
        else:
            ans = ans + 1
if ans == 0:
    print('APPROVED')
else:
    print('DENIED')

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

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

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

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

for ni in range(rangeNum):
    if n[ni]%2 == 0:
        if n[ni]%3 == 0:
            continue
        elif n[ni]%5 == 0:
            continue
        else:
            print("DENIED")
            exit()
    else:
        continue
print("APPROVED")

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

Solution (Python):
def resolve():
    import sys

    input = sys.stdin.readline

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

    denied = False

    for num in numbers:
        if num % 2 == 0 and num % 3 != 0 and num % 5 != 0 :
            denied = True
            print("DENIED")
            break

    if not denied :
        print("APPROVED")

resolve()

Solution (Python):
def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    P = map(lambda a: a % 2 == 1 or (a % 3 == 0 or a %5 == 0), A)
    print('APPROVED' if all(P) else 'DENIED')

resolve()

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

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

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

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

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

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

Solution (Python):


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

f = True
for a in a_l:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            print('DENIED')
            f = False
            break

if f:
    print('APPROVED')

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

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

Solution (Python):

N = int(input())


input_list = input().split( )

counter = 0

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

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

N = int(input())
A = list(map(int, input().split()))
A = [i for i in A if i%2==0]

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

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

def app():
    for i in a:
        if i%2==0:
            if i%3 !=0 and i%5!=0:
                return "DENIED"
    return "APPROVED"

print(app())

Solution (Python):
from __future__ import print_function

import sys

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd



import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def main():
    n = int(input().strip())
    a = list(map(int, input().strip().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")
                return
    print("APPROVED")


if __name__ == '__main__':
    main()

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

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

for i in range(len(a)):
    mod1 = a[i] % 2
    if mod1 == 0:
        mod2 = a[i] % 3
        mod3 = a[i] % 5
        if mod2 != 0 and mod3 != 0:
            print('DENIED')
            exit()
print('APPROVED')

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

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

Bool = True

aintlist = input().split(" ")

alist=[]

for i in range(n):
    alist.append(int(aintlist[i]))

for i in range(n):
    if alist[i]%2==0 and not(alist[i]%3==0 or alist[i]%5==0):
        Bool = False

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

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

flag=True
for a in A:
    if a%2==0:
        if (a%3!=0)&(a%5!=0):
            flag=False
            break

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

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

list2=[]
for i in list:
    if i%2==0:
        list2.append(i)

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

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

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

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

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

print(ans)

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

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

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

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

Solution (Python):

import sys


YES = "APPROVED"
NO = "DENIED"

def solve(N: int, A: "List[int]"):
    for a in A:
        if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
            print(NO)
            return
    print(YES)


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)]
    solve(N, A)

if __name__ == '__main__':
    main()

Solution (Python):
def main():

    N = int(input())
    A = list(map(int, input().split()))
    for v in A:
        if v % 2 == 0 and (v % 5 != 0 and v % 3 != 0): return "DENIED"
    return "APPROVED"

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

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

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

flag = True

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

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

Solution (Python):

if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    ev = [e for e in a if e % 2 == 0]
    c = [e for e in ev if e % 3 == 0 or e % 5 == 0]
    print('APPROVED' if len(ev) == len(c) else 'DENIED')

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

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

c = True
for i in l:
    if i % 2 == 0:
        if (i%3 == 0) or (i%5 == 0):
            continue
        
        else:
            c = False
    
if c:
    print('APPROVED')

else:
    print('DENIED')

Solution (Python):
N = int(input())
Alist = list(map(int,input().split()))
ans = 'APPROVED'
for a in Alist:
  if a%2 == 0 :
    if not(a%3 == 0) and not(a%5 == 0):
      ans = 'DENIED'
      break
print(ans)

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

for i in l_in:
  if i % 2 == 0 and not (i % 6 == 0 or i % 10 == 0):
    ans = 'DENIED'

print(ans)

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

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

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

ans = True
for num in A:
  if num%2==0:
    if not(num%3==0 or num%5==0):
      ans = False
      break
      
if ans:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
N = int(input())
a = list(map(int, input().split()))
aeve = map(lambda x: x if x % 2 == 0 else 0, a)
ad35 = map(lambda x: True if x % 3 == 0 or x % 5 == 0 else False, aeve)
print("APPROVED") if all(ad35) else print("DENIED")

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

output = 'APPROVED'
for n in A:
    if (n % 2 == 0) and (n % 6 != 0) and (n % 10 != 0):
        output = 'DENIED'
        
print(output)

Solution (Python):







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

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

print(ans)

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

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

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


if __name__ == '__main__':
    main()

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

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

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


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

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

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

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

Solution (Python):


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


if __name__ == "__main__":
    solve()

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

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

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

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

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

if TorF == True:
  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()))
result = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()

print(result)

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

for i in range(num):
  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=[]
ans='DENIED'
for i in range(len(a)):
    if(a[i]%2==0):
        b.append(a[i])
f=0
for i in range(len(b)):
    if((b[i]%3==0)|(b[i]%5==0)):
        f+=1
if(f==len(b)):
    ans='APPROVED'
print(ans)

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

box = []
for i in range(n):
    if number[i] % 2 == 0:
        box.append(number[i])

for j in box:
    if j % 3 ==0:
        continue
    elif j % 5 ==0:
        continue
    else:
        print("DENIED")
        exit()
else:
    print("APPROVED")

Solution (Python):
N = input()
X = [x for x in list(map(int, input().split())) if x % 2 == 0]
Y = [y for y in X if y % 3 == 0 or y % 5 == 0]
print('APPROVED' if len(X) == len(Y) else 'DENIED')

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

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

print(result)

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

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

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

flag = 1
for a in A:
    if not a % 2 and a % 3 and a % 5:
        print("DENIED")
        exit()
print("APPROVED")

Solution (Python):
n = int(input())
A = list(map(int, input().split()))
even_count = 0
ans_count = 0
for a in A:
    if a%2==0:
        even_count += 1
        if a%3==0 or a%5==0:
            ans_count+=1

        else:
            print('DENIED')
            break
if even_count == ans_count:
    print('APPROVED')

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

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

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

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

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

Solution (Python):
n=int(input())
li=list(map(int,input().split()))
even=[]
ans="APPROVED"

for i in li:    
  if i%2==0:
    even.append(i)
    
for j in even:
  if j%3!=0 and j%5!=0:
    ans="DENIED"
print(ans)

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

Solution (Python):
N = int(input())
A = (input().split())
i_count = 0
test = []
for i in A:
  num = int(i) % 2
  if num == 0 :
    test.append(i)

for i in test:
  num3 = int(i) % 3
  num5 = int(i) % 5
  if num3 == 0 or num5 ==0:
    i_count += 1

if i_count == len(test):
  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 or A[i]%5==0:
            pass
        else:
            ans="DENIED"
    else:
        pass

print(ans)

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

evens = []
judge = True
for a in A:
    if a % 2 == 0:
        evens.append(a)
for even in evens:
    if even % 3 != 0 and even % 5 != 0:
        judge = False
print("APPROVED") if judge else print("DENIED")

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

Solution (Python):
def listint():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

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

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

for a_n in a:
    if a_n % 2 == 0:
        if a_n % 3 == 0 or a_n % 5 == 0:
            continue
        else:
            print('DENIED')
            break
else:
    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")
      break
else:
  print("APPROVED")

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

Solution (Python):



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

test = []

for i in num:
    if i % 2 != 0:
        test.append(True)
    elif i % 2 == 0 and i % 3 == 0:
        test.append(True)
    elif i % 2 == 0 and i % 5 == 0:
        test.append(True)
    else:
        test.append(False)

if all(test):
    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 % 5 != 0 and a % 3 != 0:
      print('DENIED')
      break
else:
  print('APPROVED')

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


a2 = [x for x in a if x % 2 == 0]
if len(a2) == 0: 
    print("APPROVED")
    exit()

a3 = [x for x in a2 if x % 3 == 0 or x % 5 == 0]
if len(a3) == len(a2): 
    print("APPROVED")
    exit()

print("DENIED")

Solution (Python):
import sys
n=int(input())
a = list(map(int,input().split())) 
flg=True
for i ,item in enumerate(a):
    if not(item&1): 
        if(item%3==0 or item % 5==0):
            continue
        else:
            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 or i % 5 ==0:
      continue
    else:
      print('DENIED')
      exit()
      
print('APPROVED')

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


def judge(A):
    for a in A:
        if (a % 2 != 0):
            continue
        if ((a % 3 == 0) or (a % 5 == 0)):
            continue
        else:
            return 'DENIED'
    return 'APPROVED'


print(judge(A))

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 = input()
v = list(map(int,input().split()))
flag = True
for i in v:
  flag = flag and (i % 2 == 1 or i % 3 == 0 or i % 5 == 0)
print("APPROVED" if flag else "DENIED")

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

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

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

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

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

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

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

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

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
        break
if flag:
    print('APPROVED')
else:
    print('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
        break
if flag:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import sys

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

for c in chkList:
  if c%2 == 0 and c % 6 != 0 and c % 10 != 0:
    print('DENIED')
    sys.exit()

print('APPROVED')

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

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

Solution (Python):
n = int(input())
a = [int(i) for i 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):
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 'APPROVED'
    for a in A:
        if a % 2 == 0:
            if a % 3 != 0 and a % 5 != 0:
                return 'DENIED'

    return ans

print(solve())