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

E = [ i for i in A if (i%2) == 0]
C = [ j for j in E if (j%3) == 0 or (j%5) == 0]

print('APPROVED' if len(E) == len(C) else 'DENIED')

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

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:
    if A[i]%3 == 0 or A[i]%5 == 0:
      continue
    else:
      approved = False
  
print("APPROVED" if approved == True else "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):
N = int(input())
Data = list(map(int,input().split()))
ans = True
for data in Data:
    if data % 2 == 0:
        if data % 3 == 0 or data % 5 == 0:
            pass
        else:
            ans = False
            break
if ans:
    print('APPROVED')
else:
    print('DENIED')

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
bl = True
for v in A:
    if v%2==0 and not(v%3==0 or v%5 == 0):
        bl = False

print('APPROVED' if bl else '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):
def main():
    N = int(input())
    li = list(map(int, input().split()))
    li2 = [i for i in li if not (i % 2)]
    ans = "APPROVED"
    for j in li2:
        if (j % 3) and (j % 5):
            print("DENIED")
            quit()
    print(ans)


if __name__ == "__main__":
    main()

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

for i in a:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            pass
        else:
            ans.append(i)
    else:
        pass

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

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

main()

Solution (Python):
def main():
    n = 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")
    
if __name__ == '__main__':
    main()

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

Solution (Python):


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

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

flag = True
for s in sub:
    if not (s % 3 == 0 or s % 5 == 0):
        flag = False

print('APPROVED' if flag 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 or a[i] % 5 == 0:
            continue
        else:
            print('DENIED')
            exit()
print('APPROVED')

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

Solution (Python):
n = int(input())
array = map(int,input().split())
res = 0
for i in array:
    if(i%2 == 0 and (i % 3 !=0 and i%5 != 0)):
        res = -1
        print("DENIED")
        break

if res != -1:
    print("APPROVED")

Solution (Python):
n = int(input())
num_list = list(map(int, input().split()))
den_list = []
for num in num_list:
    if num % 2 == 0:
        if num % 3 != 0 and num % 5 != 0:
            den_list.append(num)
if len(den_list) == 0:
    print('APPROVED')
else:
    print('DENIED')

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

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

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

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

Solution (Python):
import sys
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))

n = int(input())
A = ILI()
ans = "APPROVED"
for a in A:
	if a%2==0:
		if a%6!=0 and a%10!=0:ans="DENIED"
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 and i%5!=0:
            result='DENIED'
print(result)

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

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

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

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

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

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

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

for i in range(N):
    if (A[i] % 2 == 0) and (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()))
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

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

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): 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 LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]

def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]

def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

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

Solution (Python):

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

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

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

flg = 1
for i in range(N):
    if (A[i] % 2 == 0):
        if(A[i] % 3 == 0 or A[i] % 5 == 0):
            flg = 1
        else:
            flg = 0
            break

if(flg == 1):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
A_even = [i for i in A if i % 2 == 0]
flag_list = list(map(lambda x: (x % 3 == 0) or (x % 5 == 0), A_even))
print('APPROVED' if False not in flag_list else 'DENIED')

Solution (Python):
import sys

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

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

print("APPROVED")

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

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

if all(map(lambda x: x%3 == 0 or x%5 == 0 if x%2 == 0 else True, A)):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):

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

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
flag=1
for i in l:
    if i%2==0:
        if i%3==0 or i%5==0:
            continue
        else:
            flag=0
            break
if flag==0:
    print("DENIED")
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 :
      if i%5 != 0:
        print("DENIED")
        exit()
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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
even = []
approved = []

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

for i in even:
    if i%3==0 or i%5==0:
        approved.append(i)

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

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

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

for j in even:
    if j % 3 == 0 or j % 5 == 0:
        cnt += 1

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

Solution (Python):
n = int(input())
a = []

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

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

print(judge)

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

print('APPROVED')

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

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

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

for j in range(len(x)):
    if x[j] % 3 != 0 and x[j] % 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'

print(ans)

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

Solution (Python):
N = 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):
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
a = nl()

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

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

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

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

Solution (Python):

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

for _a in a:
  if _a % 2 == 0 and _a % 3 != 0 and _a % 5 != 0:
    ret = 'DENIED'

print(ret)

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

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

print('APPROVED')

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

even_numbers = []
count = 0

for a in A:
    if a % 2 == 0:
        even_numbers.append(a)
for a in even_numbers:
    if a % 3 == 0 or a % 5 == 0:
        continue
    else:
        count +=1
if count >= 1:
    print('DENIED')
else:
    print('APPROVED')

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

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

isNotCorrect = False

for i in range(n):
    num = l[i]
    if(num%2==0 and not (num%3==0 or num%5==0)):
        isNotCorrect = True

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

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

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

c = 0
for i in range(0, N):
  if a[i]%2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
      c += 1
  else:
    c += 1

if c == N:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
l = []
l_even = [i for i in a if i % 2 == 0]
for i in range(n):
  if a[i] % 2 == 0:
    if a[i] % 3 == 0 or a[i] % 5 == 0:
    	l.append(1)

if sum(l) != len(l_even):
  print('DENIED')
else:
  print('APPROVED')

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

a =[]

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

for j in a:
  if j%3==0 or j%5==0:
    continue
  else:
    count +=1

print("APPROVED" if count ==0 else "DENIED")

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

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            pass
        else:
            result = 'DENIED'
print(result)

Solution (Python):
from sys import exit

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()))
l = list(filter(lambda x: x %2 == 0,a))

for i in l:
  if i % 3 != 0 and i % 5 != 0:
    print("DENIED")
    exit()
    
print("APPROVED")

Solution (Python):
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
a=list(map(int,stdin.readline().split()))
poss=True
for i in a:
    if(i%2==0):
        if(i%3!=0 and i%5!=0):
            poss=False
            break
if(poss):
    print("APPROVED")
else:
    print("DENIED")

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

result = 'APPROVED'

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

print(result)

Solution (Python):
N = int(input())
*A, = map(int, input().split())
for a in A:
    if a%2==0:
        if a%3!=0 and a%5!=0:
            print("DENIED")
            exit()
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):
import collections
n,elems = int(raw_input()), map(int, raw_input().split(' '))

def f(elems):
	for e in elems:
		if e % 2 == 0:
			if not((e % 3 == 0) or (e % 5 == 0)):
				return False
	return True

print 'Approved'.upper() if f(elems) else 'Denied'.upper()

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

Solution (Python):
import sys


def main():
    N = int(input())
    A_list = list(map(int, input().split()))

    ans = 'APPROVED'
    for i_A in A_list:
        if i_A % 2 == 1:
            continue

        if i_A % 3 != 0 and i_A % 5 != 0:
            ans = 'DENIED'

    print(ans)

    return


if __name__ == "__main__":
    main()
    sys.exit(0)

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

print('APPROVED' if check==0 else 'DENIED')

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

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

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

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

Solution (Python):
input()
print("APPROVED" if all(not all((a % 3, a % 5)) for a in map(int, input().split()) if not a % 2) else "DENIED")

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

for i in a:
  if i%2 ==0:
    b.append(i)
    
for i in b:
  if i%3 == 0 or i%5 == 0:
    t += 1
    
if t== 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:
    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
cnt = 0
for i in range(n):
    if a[i] % 2 == 0 and (a[i] % 3 == 0 or a[i] % 5 == 0):
        count += 1
    if a[i] % 2 == 0:
        cnt += 1

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

Solution (Python):
n = input()
A = list(map(int,input().split()))
dic ={}
for i in A:
    if i%2 ==0:
        dic[i]=1
l = []
for j in dic.keys():
    if j%3 != 0 and j%5 != 0:
        print("DENIED")
        break
    else:
        l.append(j)
if len(l)==len(dic):
    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:
            continue
        else:
            print('DENIED')
            break
else:
    print('APPROVED')

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

for item in a:
    if item % 2 ==0:
      if item % 5!=0 and item % 3!=0:
        dn=dn+1
        break
if dn>0:
  print('DENIED')
else:
  print('APPROVED')

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


def main():
    N = int(input())
    A = list(map(int, input().split()))
    assert N == len(A)
    for i in A:
        if i % 2 == 0 and not (i % 3 == 0 or i % 5 == 0):
            print("DENIED")
            exit()
    print("APPROVED")


if __name__ == '__main__':
    main()

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

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

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

print("APPROVED")

Solution (Python):
import sys
n=int(input())
nl=list(map(int, input().split(" ")))

for i in range(n):
 if nl[i]%2==0:
  
  if nl[i]%6 !=0 and nl[i]%10!=0:
   print("DENIED")
   sys.exit()
print("APPROVED")

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

for i in an:
  if i % 2 == 0 and 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
for i in range(N):
    if (A[i] % 2 == 0):
        if not (A[i] % 3 == 0 or A[i] % 5 == 0):
            count += 1
if count == 0:
    print("APPROVED")
else:
    print("DENIED")

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

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

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


for i in A_list:
    if i % 3 == 0 or i % 5 == 0:
        pass

    else:
        print("DENIED")
        exit()

print("APPROVED")

Solution (Python):

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

i=0
while i<N:
    
    if List[i]%2==0:
        
        if List[i]%3==0 or List[i]%5==0:
            pass
        else:
            print("DENIED")
            quit()
        
    i+=1
    
print("APPROVED")

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


def check(n):
    return n % 2 == 1 or n % 3 == 0 or n % 5 == 0


if all(map(check, A)):
    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()))

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())
S = list(map(int, input().split()))
flg = True
for num in S:
    if num%2 == 0:
        if num%3 !=0 and num%5 != 0:
            flg = False
            break
if flg:
    print("APPROVED")
else:
    print("DENIED")

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

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

print(ans)

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


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

a=0
for i in A_list:
    if i%2==0 and (i%3!=0 and i%5!=0):
        a+=1

if a>0:
    print('DENIED')
else:
    print('APPROVED')

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

Solution (Python):
import fileinput

n = int(input())

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

b = True

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

if b:
    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")
      exit()
print("APPROVED")

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

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

Solution (Python):
array = []

for i in range(2):
    val = [int(s) for s in input().split()]
    array.append(val)

A = array[1]
check = 0

for i in A:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            check += 1


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

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

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

print('APPROVED')

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

is_approved = True

for A_i in A:
    if A_i%2==0:
        if A_i%3 != 0 and A_i%5 != 0:
            is_approved = False
            break

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

Solution (Python):
n = int(input())
a = list(map(int, input().split()))
ans = 0
c = 0
for i in a:
	if i % 2 == 0:
		c += 1
		if i % 3 == 0 or i % 5 == 0:
			ans += 1
		else:
			ans -= 1
			
if ans == c:
	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:
        if a[i]%3!=0 and a[i]%5!=0:
            flag=False
            break

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

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

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

Solution (Python):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

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

n = int(input())
a = LI()
a = [i for i in a if i%2==0]
flg = 0
for i in a:
    if i%3==0 or i%5==0:
        
        pass
    else:
        flg = 1
print('APPROVED' if flg==0 else 'DENIED')

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

Solution (Python):
from sys import stdin, setrecursionlimit


def main():
    n = int(stdin.readline())
    a = list(map(int, stdin.readline().split()))

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


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
B = 0
for i in range(N):
  if A[i]%6 == 0 or A[i]%10 == 0:
    continue
  elif A[i]%2 == 1:
    continue
  else:
    B = 1
print('APPROVED' if B==0 else 'DENIED')

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

ls = list(filter(lambda x: x % 2 == 0, buff))

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

print('APPROVED')

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