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=input()
A=input().split()

def validate(i):
    I=i%2
    if I==0:
        I1=i%3
        I2=i%5
        if I1==0 or I2==0:
            return "Yes"
        else:
            return "No"
    else:
        return "Yes"

X = []
for i in A:
    X.append(validate(int(i)))

if "No" in X:
    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 and i % 5 != 0:
            print("DENIED")
            break
else:
    print("APPROVED")

Solution (Python):
input()
for d in map(int,input().split()):
  if d%2==0 and not (d%3==0 or d%5==0):
    print('DENIED')
    break
else:
  print('APPROVED')

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

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
t = True
for i in a:
    if i%2 == 0:
        if i%3 != 0 and i%5 !=0:
            t = False
            break
print("APPROVED" if t 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 = list(map(int,input().split()))
count = 0
result = 0
for n in range(N):
    if A[n] % 2 == 0:
        An = A[n]
        count += 1
        if An % 3 == 0 or An % 5 == 0:
            result += 1
if count == result:
    print("APPROVED")
else:
    print("DENIED")

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

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

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

Solution (Python):
a = int(input())
 
b=list(map(int, input().split())) 
x = 0
c = 0
    
for i in b:
  if ((i % 3 == 0) or (i % 5 == 0)) and (i % 2 == 0):
    x += 1

for t in b:
  if (t%2==0):
    c += 1;

if x == c:
  print('APPROVED')
else :
  print('DENIED')

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

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

Solution (Python):


if __name__ == "__main__":
    N = int(input())
    A = map(int, input().split())
    for i in A:
        if i % 2 ==0:
            if i % 3 != 0 and i % 5 != 0:
                    print("DENIED")
                    exit(0)
            else:
                pass
        else:
            pass
    print("APPROVED")

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

even =[]

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

for i in even:
    if i%3 != 0 and i%5 != 0:
        flag = False
        break
    
if flag:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):

n=int(input())
a=list(map(int,input().split()))
t=0
for i in a:
  if i % 2==0:
    if i%3==0:
      continue
    elif i%5==0:
      continue
    else:
      t=1
      print("DENIED")
      break

if t==0:
  print("APPROVED")

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
B=[i for i in A if i%2==0]
C=[i for i in B if i%3==0]
D=[i for i in B if i%5==0]
E=[i for i in B if i%15==0]
if len(B)==len(C)+len(D)-len(E):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
N=int(input())
List=list(map(int,input().split()))
nList=[e for e in List if e % 2 == 0]
tmp = []
while nList:
  f = nList.pop()
  if f % 3 != 0 and f % 5 != 0:
    tmp.append(f)
if not tmp:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
i1 = int(input())
i2 = list(map(int, input().split()))
    
l = []
for i in range(i1):
  if i2[i] % 2 == 0:
    if i2[i] % 3 == 0 or i2[i] % 5 == 0:
        l.append('APPROVED')
    else:
        l.append('DENEID')
    
if (all(str == 'APPROVED' for str in l)):
	print('APPROVED')
else:
  	print('DENIED')

Solution (Python):
n = int(input())
L = list(map(int, input().split()))
for i in L:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            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 not(A[i]%3==0 or A[i]%5==0):
      print('DENIED')
      exit()      
else:
  print('APPROVED')

Solution (Python):
def contest(N, str):
    a_str = []
    a = []

    a_str= map(int,str.split(' '))
    for char in a_str:
        a.append(int(char))

    result = True

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

    if result == True:
        return 'APPROVED'
    else:
        return 'DENIED'


if __name__ == "__main__":
    N = int(input())
    str = input()

    print(contest(N, str))

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

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 or i%5==0:
      ans = 'APPROVED'
    else:
      ans = 'DENIED'
      break

print(ans)

Solution (Python):



a = int(input())

st = input().split()
st_list = []
st_list = [int(st) for st in st]

num = 0
flg = 0
for num in range(len(st_list)):
  if(st_list[num] % 2 == 0):
    if(st_list[num] % 5 != 0 and st_list[num] % 3 != 0):
      flg = 1
if(flg == 0):
  print("APPROVED")
else:
  print("DENIED")

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

Solution (Python):
n = input()
list = input().split(" ")
list = [int(a) for a in list]
even = [a for a in list if a % 2==0]
ans = []
for a in even:
    if a % 3 == 0 or a % 5 == 0:
        ans.append(True)
if len(even) ==len(ans):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = int(input())
flag=0
lst = [int(i) for i in input().split()][:n]
for i in lst:
    if i%2==0 and i%3!=0 and i%5!=0:
        flag=1 
    else:
        continue
if flag==1:
    print("DENIED")
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 or a % 5 == 0:
            continue
        else:
            flag = False

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

Solution (Python):
n = input()
nums = input().split()
check = 1
for num in nums:
  a = int(num)
  if a % 2 == 0 and a % 3 != 0 and a % 5 != 0:
    check = 0

if check == 1:
  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:
      continue
    else:
      ans = "DENIED"
      
print(ans)

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

approved = True
An = input().split(" ")

for i in range(N):
	A = int(An[i])
	if A % 2 == 0:
		if A % 3 != 0 and A % 5 != 0:
			approved = False
			
if approved:
	print("APPROVED")
else:
	print("DENIED")

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

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

Solution (Python):

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

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

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

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
l = list(map(int, stdin.readline().rstrip().split()))
s = 0
for A in l:
    if A%2==0 and A%3!=0 and A%5!=0:
        s = s
    else:
        s = s+1
if s == n:
    print('APPROVED')
else:
    print('DENIED')

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

c = list(filter(lambda n:(n%2==0 and n%3!=0 and n%5!=0), A))

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

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
flag = 'ap'
for i in range(N):
  if A[i]%2 == 0:
    if A[i]%3 == 0 or A[i]%5 == 0:
      continue
    else:
      flag = 'den'

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

Solution (Python):
n=int(input())
l=list(input().split())
ln=[]
m=0
for i in l:
  if int(i)%2==0:
    ln.append(int(i))
for k in ln:
  if k%3==0 or k%5==0:
    m=m+1
if m==len(ln):
  print("APPROVED")
else:
  print("DENIED")

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

def qqq(x):
    if x % 2 == 0 and x % 3 != 0 and x % 5 != 0:
            return 1
    return 0

p = 0

for i in range(n):
    p = p + qqq(int(a[i]))
    
if p == 0:
    print('APPROVED')
    
else:
    print('DENIED')

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

def check(a):
    for i in range(N):
        if a[i] %2 == 0:
            if a[i]%3 != 0 and a[i]%5 != 0:
                return "DENIED"
    return "APPROVED"

print(check(a))

Solution (Python):
def fun(li):
  for i in li:
    if i%2 == 0:
      if i%3 == 0 or i%5 ==0:
        continue;
      else:
        return "DENIED"
  return "APPROVED"
n = int(input())
li = [int(num) for num in input().split(" ")]
print(fun(li))

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

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

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

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

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

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

Solution (Python):
a=int(input())
li = list(map(int,input().split()))
li = list(filter(lambda x:x%2==0,li))
t=len(li)
li = list(filter(lambda x:(x%3==0 or x%5==0),li))
c=len(li)
if(c==t):
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
from sys import stdin


def get_result(data):
    N, A = data
    for a_i in A:
        if a_i % 2 == 0 and a_i % 3 != 0 and a_i % 5 != 0:
            return 'DENIED'

    return 'APPROVED'

if __name__ == '__main__':
    raw_data = [val.rstrip('\n') for val in stdin.readlines()]
    data = [list(map(int, val.split(' '))) for val in raw_data]
    result = get_result(data)
    print(result)

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

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

for j in range(len(b)):
    if b[j]%3 == 0 or b[j]%5 == 0:
        wk = 1
    else:
        wk1 = 1
if wk1 == 1:
    print('DENIED')
else:
    print('APPROVED')

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

def approve(n):
    if (n % 2 == 0):
        if (n % 3 == 0):
            return True
        if (n % 5 == 0):
            return True
        return False
    return True
if (all(list(map(approve, A)))):
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
def check(input_list):
    for a in input_list:
        a = int(a)
        if(a % 2 == 0 and not(a % 3 == 0 or a % 5 == 0)):
            return False
    
    return True

if __name__ == '__main__':
    num = input()
    input_list = [int(a) for a in input().split()]
    
    if check(input_list):
        print("APPROVED")
    else:
        print("DENIED")

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

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

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


for a in aa:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      pass
    else:
      print('DENIED')
      break
else:
  print('APPROVED')

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

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

Solution (Python):
import numpy as np
import sys

n = int(input())
aList = input().split(" ")

aList = np.array(aList, dtype=np.int)
aList = aList[aList % 2 == 0]

a = list(aList[aList % 5 == 0])
b = list(aList[aList % 3 == 0])

aList = set(list(aList))

if len(aList) == len(set(a + b)):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import sys

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

for i in range(n):
  a = li[i]
  if a%2 ==0:
    if (a % 3 == 0 or a % 5 == 0)==False:
      print("DENIED")
      sys.exit()

print("APPROVED")

Solution (Python):

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

ok = 0

for i in range(a):
    if lis[i] % 2 == 0:
        
        if lis[i] % 3 != 0 and lis[i] % 5 != 0:
            
            ok =1

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

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

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

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

evens = []
evens_count = 0
approved = "DENIED"
out_frag = 0

for i in range(n):
    if a[i] % 2 == 0:
        evens.append(a[i])
        evens_count += 1

if evens_count > 0:
    for j in range(evens_count):
        if (evens[j] % 3 == 0) or (evens[j] % 5 == 0):
            pass
        else:
            out_frag = 1
    if out_frag == 0:
        approved = "APPROVED"
elif evens_count == 0:
    approved = "APPROVED"

print(approved)

Solution (Python):
def solve():
    n = int(input())
    for a in map(int, input().split()):
        if a % 2 == 0:
            if not (a % 3 == 0 or a % 5 == 0):
                return "DENIED"
    return "APPROVED"
print(solve())

Solution (Python):
number = int(input())
list_number = input().split()

ok = 0
for i in list_number:
    if int(i) % 2 == 0:
        if int(i) % 3 == 0 or int(i) % 5 == 0:
            pass
        else:
            ok = 1
            print("DENIED")
            break

if ok == 0:
    print("APPROVED")

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

  if i%2==0:
    if not i%3==0 and not i%5==0:
      print("DENIED")
      x=1
      break
    else:
      continue
    
  else:
   	continue
  break
if x ==0:
	print("APPROVED")

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

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

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

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

for x in AS:
    if x % 2 == 1: continue
    if (x % 3 != 0) and (x % 5 != 0):
        print("DENIED")
        break
else:
    print("APPROVED")

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

judge = True

for i in range(length):
  a = li[i]
  if a % 2 == 0:
      if not (a % 3 == 0 or a % 5 == 0):
          judge = False
          break;
  
if judge:
  print("APPROVED")
else:
  print("DENIED")

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

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

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

is_True = True
for p in people:
    if p % 2 == 0:
        if p % 3 != 0 and p % 5 != 0:
            is_True = False
            break

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

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

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

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

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

for ai in a:
  if ai % 2 == 0:
    if ai % 6 != 0 and ai % 10 != 0:
      print('DENIED')
      break
else:
  print('APPROVED')

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

ans=True       
for i in b:
    if i%3==0 or i%5==0:
        ans=True
    else:
        ans=False
        break
        
if ans:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
def ii(): return int(input())
def si(): return input()
def mi(): return map(int,input().split())
def li(): return list(mi())

import math 

for i in range(1):
    n=ii()
    a=li()
    for i in range(n):
        if (a[i]%2==0 and (a[i]%3==0 or a[i]%5==0)) or a[i]%2:
            continue
        else:
            print("DENIED")
            exit()
    print("APPROVED")

Solution (Python):
a = int(input())
n = [int(x) for x in input().split()]
b = [i for i in n if i % 2 == 0 ]
f = 0
for i in range(len(b)):
  if b[i] % 3 == 0:
    f += 1
    continue
  if b[i] % 5 == 0:
    f += 1
    continue
if len(b) == f:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):


N=int(input())
i = list(map(int, input().split()))
c=0

for k in range(0,N):
  if i[k]%2==0:
    if (i[k]%3!=0) and (i[k]%5!=0):
      c=c+1

if c==0:
  print('APPROVED')
else:
  print('DENIED')

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

Solution (Python):

n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2 == 0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) == len(answer):
    print("APPROVED")
else:
    print("DENIED")

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 or i%5==0:
            ans="APPROVED"
        else:
            ans="DENIED"
            break
    else:
        continue
        
print(ans)

Solution (Python):




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


deny_flag = False



for Ai in An_list:
    if Ai % 2 == 0:
        if (Ai % 3 == 0) or (Ai % 5 == 0):
            
            pass
        else:
            
            print("DENIED")
            deny_flag = True
            break



if not deny_flag:
    print("APPROVED")

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

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

Solution (Python):
flag = 0
a = input()
b = list(map(int,input().split()))
for c in b:
    if c%2 == 0:
        if not (c%3 == 0 or c%5 == 0):
            flag = 1

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

Solution (Python):
from sys import exit

N = int(input())
A = tuple(map(int, input().split()))
for a in A:
    if a % 2 == 0:
        if not(a % 3 == 0 or a % 5 == 0):
            print('DENIED')
            exit()
print('APPROVED')

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

Solution (Python):
def main():
    N = input()
    lists = map(int,input().split())
    for i in lists:
        if not (i % 2):
            if ((i % 3) and (i % 5)):
                print("DENIED")
                return
    print("APPROVED")
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
ais = list(map(int, input().split()))
evens = []
for a in ais:
  if a % 2 == 0:
    evens.append(a)
if len(evens) == 0:
  print("APPROVED")
  quit()
m = 0
for e in evens:
  if e % 3 == 0 or e % 5 == 0:
    pass
  else:
    m += 1
if m == 0:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
n = input()
lst = list(map(int,input().split()))
even = []
deny = 0

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

for j in even:
    if j % 3 == 0 or j % 5 == 0:
        continue
    else:
        deny = 1

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

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

flag = True

for i in a:
  if i % 2 == 0:
    if i % 3 == 0 or i % 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()))
B = []
C = []
D = []
for i in range(N):
  if A[i] % 2 == 0: 
    C.append(A[i])
  elif A[i] % 2 != 0:
    B.append(A[i])
for i in (range(len(C))):
  if C[i] % 3 == 0 or C[i] % 5 == 0:
    D.append(C[i])
if len(C) >= 1:
  if len(C) == len(D):
    print('APPROVED')  
  else:
    print('DENIED')
  
else:
  if len(A) == len(B):
    print('APPROVED')

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
B=[]
for i in range (N):
    if A[i]%2==0:
        B.append(A[i])

x=len(B)
hantei=0
for i in range(x):
    if B[i]%3==0:
        hantei=hantei+1
    elif B[i]%5==0:
        hantei=hantei+1
    else:
        pass

if hantei>=x:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
n = int(input())
a = 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 = map(int, input().split())
lis = [6, 10, 12, 18, 20, 24, 30, 36, 40, 42, 48, 50, 54, 60, 66, 70, 72, 78, 80, 84, 90, 96, 100, 102, 108, 110, 114, 120, 126, 130, 132, 138, 140, 144, 150, 156, 160, 162, 168, 170, 174, 180, 186, 190, 192, 198, 200, 204, 210, 216, 220, 222, 228, 230, 234, 240, 246, 250, 252, 258, 260, 264, 270, 276, 280, 282, 288, 290, 294, 300, 306, 310, 312, 318, 320, 324, 330, 336, 340, 342, 348, 350, 354, 360, 366, 370, 372, 378, 380, 384, 390, 396, 400, 402, 408, 410, 414, 420, 426, 430, 432, 438, 440, 444, 450, 456, 460, 462, 468, 470, 474, 480, 486, 490, 492, 498, 500, 504, 510, 516, 520, 522, 528, 530, 534, 540, 546, 550, 552, 558, 560, 564, 570, 576, 580, 582, 588, 590, 594, 600, 606, 610, 612, 618, 620, 624, 630, 636, 640, 642, 648, 650, 654, 660,666, 670, 672, 678, 680, 684, 690, 696, 700, 702, 708, 710, 714, 720, 726, 730, 732, 738, 740, 744, 750, 756, 760, 762, 768, 770, 774, 780, 786, 790, 792, 798, 800, 804, 810, 816, 820, 822, 828, 830, 834, 840, 846, 850, 852, 858, 860, 864, 870, 876, 880, 882, 888, 890, 894, 900, 906, 910, 912, 918, 920, 924, 930, 936, 940, 942, 948, 950, 954, 960, 966, 970, 972, 978, 980, 984, 990, 996]
tmp = []
for i in s:
    if i % 2 == 0:
        if i not in lis:
            print('DENIED')
            exit()
print('APPROVED')

Solution (Python):
n = input()
_list = input().split(" ")
_list = [int(x) for x in _list]
even = [x for x in _list if x % 2==0]
answer = []
for x in even:
    if x % 3 == 0 or x % 5 == 0:
        answer.append(True)
if len(even) ==len(answer):
    print("APPROVED")
else:
    print("DENIED")

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

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

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

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

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

print("APPROVED")

Solution (Python):
n = int(input())
arr = []
arr = input().split() 
arr = [int(l) for l in arr]
even = [l for l in arr if l % 2 == 0]      
answer = []
for i in even: 
    if i % 3 == 0 or i % 5 == 0:
        answer.append(True)
if len(answer) == len(even): 
    print("APPROVED")
else: 
    print("DENIED")

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

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


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

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

Solution (Python):
N = int(input())
A_N = list(map(int, input().split()))
A_N_even = []

for i in A_N:
    if i % 2 == 0:
        A_N_even.append(i)

ans = "APPROVED"
for i in A_N_even:
    if i % 3 == 0 or i % 5 == 0:
        ans = "APPROVED"
    else:
        ans = "DENIED"
        break

print(ans)