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
N=int(input())
A=list(map(int,input().split()))
flag=True
for i in range(N):
    if A[i]%2==0:
        if A[i]%3!=0 and A[i]%5!=0:
            flag=False
if flag==True:
    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())
arr = [int(s) for s in input().split(" ")]


def calculate(n,arr):

    for ar in arr:
        if ar % 2 == 0:
            s1 = ar % 3
            s2 = ar % 5
            if (s1 == 0) or (s2 == 0):
                pass
            else:
                print("DENIED")
                return

    print("APPROVED")

calculate(n,arr)

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

Solution (Python):
N = int(input())
l = list(map(int, input().split()))
 
check_list = []
for num in l:
    if num % 2 == 0:
        check_list.append(num)
 
n = len(check_list)
i = 0
while i < n:
    if (check_list[i] % 3 == 0) or (check_list[i] % 5 == 0):
        i += 1
    else: break
if i == n:
    print('APPROVED')
else: print('DENIED')

Solution (Python):
class Solution:
    def solve(self, N: int, A) -> str:

        for a in A:
            if a % 2 == 0:
                if a % 3 != 0 and a % 5 != 0:
                    return "DENIED"

        return "APPROVED"


if __name__ == '__main__':

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

    
    solution = Solution()
    print(solution.solve(N, A))

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

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

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


flag = False

for i in range(N):
  if(Ai[i]%2 == 0):
    if(Ai[i]%3 != 0 and Ai[i]%5 != 0):
      flag = True
      break

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

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

l_ = []
l__ = []
for n in range(N):
    if l[n] % 2 == 0:
        l_.append(n)

if len(l_) == 0:
    print('APPROVED')
    
if len(l_) != 0:
    for n in l_:
        if l[n] % 3 == 0 or l[n] % 5 == 0:
            l__.append(n)
            
    if len(l__) == len(l_):
        print('APPROVED')
    else :
        print('DENIED')

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
A_guu = [i for i in A if i % 2 == 0]
A_ans = [i for i in A_guu if i % 3 == 0 or i % 5 == 0]


if A_ans == A_guu:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):

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

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



if len(num) == 0:
    print('APPROVED')
    exit()
else:
    for j in range(0, len(num)):
        if num[j] % 3 != 0 and num[j] % 5 != 0:
            print('DENIED')
            exit()

print('APPROVED')

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

x=0

for i in range(0,N):
  if a[i]%2==0:



    if a[i]%3!=0:
      if a[i]%5!=0:

        x=1
if x==1:
  print("DENIED")
  exit()
print("APPROVED")

Solution (Python):
l = int(input())
k=list(map(int,input().split()))
m = []
for i in k:
  if i % 2 == 0:
    m.append(i)
for x in range(len(m)):
  if m[x] % 3 == 0 or m[x]%5==0:
    continue
  else:
    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):
num = int(input())
l = [int(i) for i in input().split(" ")]
 
deny = False
 
for ele in l:
  if ele%2==0:
    if ele%3!=0 and ele%5!=0:
      print("DENIED")
      deny = True
      break;
 
if not deny:
  print("APPROVED")

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

Solution (Python):
N = int(input())
A = list(map(int,input().split(" ")))
S = []
for a in A:
    if a % 2 == 0:
        S.append(a)
    else:
        pass
flag = True
for s in S:
    if s % 3==0 or s% 5==0:
        pass
    else:
        flag = False
if flag==True:
    print("APPROVED")
if flag == False:
    print("DENIED")

Solution (Python):
_ = raw_input()
nums = map(int, raw_input().split())

def assert_num(nums):
    is_denied = False
    for num in nums:
        if num % 2 != 0:
            
            continue
        if num % 3 == 0 or num % 5 == 0:
            
            continue
        is_denied = True
    return is_denied
            
print 'DENIED' if assert_num(nums) else 'APPROVED'

Solution (Python):

N = int(input())
A = list(map(int, input().split(' ')))
flag = True
for i in A:
    if i % 2 == 0:
        if i % 5 == 0 or i % 3 == 0:
            pass
        else:
            flag = False

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

Solution (Python):
def main():
  i = int(input())
  x = list(map(int,input().split()))
  ret = True
  for v in x:
    if isEven(v):
      if not(canDevideThreeOrFive(v)):
        ret = False
        break
  if ret:
    print("APPROVED")
  else:
    print("DENIED")

def isEven(x):
  if x%2 == 0:
    return True
  return False

def canDevideThreeOrFive(x):
  if x%3 == 0 or x%5 == 0:
    return True
  return False

main()

Solution (Python):
N = int(input())
A = [int(x) for x in input().split()]
mySet = set()
for i in A:
  if (i % 2)==0:
    mySet.add(i)   
count = 0
for j in mySet:
  if (j%3)==0 or (j%5)==0:
    count = count + 1
if count == len(mySet):
  print("APPROVED")
else:
  print("DENIED")

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

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

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

apploveflag = True

for a in range(n):
    if alist[a] % 2 == 0:
        if alist[a] % 3 != 0 and alist[a] % 5 != 0:            
            
            apploveflag = False


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

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

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

Solution (Python):

n = int(input())

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


out_flg = "N"

for i in range(len(a)):
    if a[i] %2 == 0 and a[i] %3 != 0 and a[i] %5 != 0:
        out_flg = "Y"
        break

if out_flg == "Y":
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
import sys
N = int(input())
A_N = list(map(int, input().split()))
A_N = [i for i in A_N if i % 2 == 0]

B_N = [i for i in A_N if i % 3 == 0 or i % 5 == 0]

if len(A_N) == len(B_N):
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
num = int(input())
arr = [int(i) for i in input().split()]
count = 0
for i in arr:
    if i % 2 == 0:
        if i % 3 == 0 or i % 5 == 0:
            continue
        else:
            count += 1
    else:
        continue
if count != 0:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
from math import  *
a = int(input())
b = list(map(int,input().split()))
c = []
for i in range(a):
    if b[i]%2==0:
        c.append(b[i])
g = len(c)
count = 0
for k in range(g):
    if c[k]%3==0 or c[k]%5==0:
        count = count + 1
if count == g:
    print("APPROVED")
else:
    print("DENIED")

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

Solution (Python):
n = int(input())
s_L = list(map(int,input().split()))
for i in s_L:
    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()))
tf = True
for i in a:
    if i%2 ==0:
        if i % 3 ==0:
            pass
        elif i % 5 == 0:
            pass
        else:
            tf = False
if tf:
    print('APPROVED')
else:
    print('DENIED')

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


cnt_1 = 0
cnt_2 = 0
for i in A:
	if i%2 ==0:
		cnt_1 += 1
		if i%3 == 0 or i%5==0:
			cnt_2 += 1
if cnt_1 == cnt_2:
	print('APPROVED')
else:
	print('DENIED')

Solution (Python):
_ = input()
l = [int(a) for a in input().split(' ') if int(a)%2==0]

fl = 1
for n in l:
  if n%3==0 or n%5==0:
    pass
  else:
    fl = 0
    break

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

Solution (Python):
n = int(input())
ls = map(int, input().lower().split())
even = []
for i in ls: 
  if i % 2 == 0:
    even.append(i)

count = 0
for i in even: 
  if i % 3 == 0 or i % 5 == 0:
    count = count + 1
    
if count == len(even):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
from sys import stdin,stdout
def f(A):
	for i in A:
		if i%2==0:
			if i%3!=0 and i%5!=0:
				return 'DENIED'
	return 'APPROVED'

def main():  	
	for x in stdin:

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

if __name__ == "__main__":
    main()

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

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

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


cnt = 0
for j in range(len(A_e)):
    if (A_e[j]%3 == 0) or (A_e[j]%5 == 0):
        cnt += 1
    else:
        cnt = cnt

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

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

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

k=len(abc)

for i in range(0,k):
	if abc[i] % 3 != 0 and abc[i] % 5 != 0:
		print("DENIED")
		exit()

print("APPROVED")

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

for i in range(n):
    if L[i]%2==0:
        if L[i]%3==0 or L[i]%5==0:
            continue
        else :
           print("DENIED") 
           exit()

print("APPROVED")

Solution (Python):
def main():
    n=int(input())
    aa=map(int,input().split())
    for a in aa:
        if a&1:
            continue
        if a%3==0 or a%5==0:
            continue
        print('DENIED')
        return
    print('APPROVED')
main()

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

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

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

for _ in lst:
  if _ % 2 == 0:
    if _ % 3 != 0 and _ % 5 != 0:
      i += 1
      break

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

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

Solution (Python):
def main():
    N = int(input())
    A = list(map(int, input().split()))
    B=[0]*N
    for i in range(N):
        if A[i]%2==0:
            B[i]=2
            if A[i]%3==0 or A[i]%5==0:
                B[i]=1

    for i in range(N):
        if B[i]==2:
            print("DENIED")
            return
    print("APPROVED")
    return
    
    
main()

Solution (Python):
N = int(input())
inList = list(map(int, input().split(" ")))
 
evenList = list([])
 
for item in inList:
  if item % 2 == 0:
    evenList.append(item)

jdgList = list([])
 
for evenItem in evenList:
  if ((evenItem % 3) == 0) or ((evenItem % 5) == 0):
    jdgList.append(evenItem)

if len(jdgList) == len(evenList):
  print("APPROVED")
else:
  print("DENIED")

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

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

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

A_even_35 = [i for i in A_even if i % 3 != 0and i%5!=0]
if len(A_even_35)==0:
  print("APPROVED")
else:
  print("DENIED")

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

state = 1
for i in range(n):
    if int(nums[i]) &1 == 0 :
        if int(nums[i])%3 ==0 or int(nums[i])%5 ==0:
            continue
        else:
            state= 0
            
            break
if state == 1:
    print("APPROVED")
else:
    print("DENIED")

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

K = True
for j in range(len(E)):
    if E[j] % 5 == 0 and E[j] % 3 == 0:
        pass
    elif E[j] % 5 == 0:
        pass
    elif E[j] % 3 == 0:
        pass
    else:
        K = False

print('APPROVED' if K == True else 'DENIED')

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

Solution (Python):



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

    for a in A:
        if a % 2 == 0:
            if a % 3 > 0 and a % 5 > 0:
                return "DENIED"

    return "APPROVED"


print(main())

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

result = True
for n in L:
    if n % 2 == 0:
        if ((n % 6) != 0) and ((n % 10) != 0):
            result = False
            break

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

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

Solution (Python):
n = int(input())
numbers = [int(x) for x in input().split()]
flag = 'APPROVED'
for number in numbers:
  if number%2==0 and (number % 3 == 0 or number % 5 == 0):
    continue
  elif number%2 != 0: continue
  else:
      flag = 'DENIED'
      break
print(flag)

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

    for i in range(N):
        if (A[i]%2==1):
            continue
        elif(A[i]%3!=0 and A[i]%5!=0):
            print("DENIED")
            return
    print("APPROVED")
    return

solve()

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

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

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

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

Solution (Python):
n = int(input())
ls = map(int, input().lower().split())
even = []
for i in ls: 
  if i % 2 == 0:
    even.append(i)

count = 0
for i in even: 
  if i % 3 == 0 or i % 5 == 0:
    count = count + 1
    
if count == len(even):
  print("APPROVED")
else:
  print("DENIED")

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

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

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
D = 0
for A in L:
  if A % 2 == 0:
    if A % 3 == 0 or A % 5 == 0:
      continue
    else:
      print("DENIED")
      D = 1
      break
  else:
    continue
if D != 1:
  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])

d = len(b)
if d == 0:
    print('APPROVED')
    exit()

bool == True
for c in b:
    if (c %3 != 0) and (c %5 != 0):
        bool = False
        break
    else:
        bool = True

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

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

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

Solution (Python):
import numpy as np

N = int(input())
A = [int(x) for x in input().split()]
A = np.array(A)
index = [i for i in A if i % 2 == 0]
t = 0

for i in range(len(index)):
  if (index[i] % 3 == 0) or (index[i] % 5 == 0):
    t += 1
  else:
    pass

if t == len(index):
  print("APPROVED")
else:
  print("DENIED")

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

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

res = "APPROVED"


for i in range(a):
    if b[i] % 2 == 0 and (b[i] % 3 != 0 and b[i] % 5 != 0):
        res = "DENIED"
        break
    
print(res)

Solution (Python):


def f(num):
    if num % 3 == 0:
        return True
    if num % 5 == 0:
        return True
    return False

def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    e = [i for i in a if i%2 == 0]
    flag = True

    for i in e:
        if f(i):
            pass
        else:
            flag = False

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

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

Solution (Python):
a=input()
b = list(map(int,input().split()))
t=0
for i in range(int(a)):

    if(b[i]%2==0):
        if(b[i]%3==0 or b[i]%5==0):
            t+=1
    else:
        t+=1
if t==int(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 and A[i] % 3 != 0 and A[i] % 5 != 0):
        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())
a = list(map(int, input().split()))

def dfs():
    for i in range(n):
        if  a[i]%2 ==0:
            if a[i]%3 != 0 and a[i]%5 != 0:
                return False
                    
            

if dfs() != False:
    print('APPROVED')
else:
    print('DENIED')

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

N = input()
A = LIST()

flag = 0
for a in A:
    if a % 2 == 0:
        if a % 3 != 0 and a % 5 != 0:
            print('DENIED')
            flag += 1
            break

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

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

in_flag = True
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            in_flag = True
        else:
            in_flag = False
            break
    else:
        pass

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

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

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

a=a.split(' ')

for b in range(n):
    a[b]=int(a[b])

d=0
for c in a:
    if c%2==1:
        d=d+1
    elif c%2==0:
        if c%3==0 or c%5==0:
            d=d+1
        else:
            d=d+0

if d==n:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):

import numpy as np
stdin = open(0)

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

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

error = 0
warikireru_3 = 0
warikireru_5 = 0

for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0:
            warikireru_3 = 1
        if A[i] % 5 == 0:
            warikireru_5 = 1
        if not(warikireru_3 == 1 or warikireru_5 == 1):
            error += 1
    warikireru_3 = 0
    warikireru_5 = 0

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

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = []
C = []
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:
    C.append(B[j])
if len(B) == len(C):
  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):
a = int(input())
b = list(map(int,input().split()))
r = "APPROVED"
for i in range(a):
  if b[i] % 2 == 0:
    if b[i] % 3 == 0 or b[i] % 5 == 0:
      r = "APPROVED"
    else:
      r = "DENIED"
      break
print(r)

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

Solution (Python):
def main():
    N = int(input())
    A = input().split()
    for i in range(len(A)):
        A[i] = int(A[i])


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


main()

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

cnt = 0
ret = 0
for i in a:
    if i % 2 == 0:
        cnt += 1
        if i % 3 == 0 or i % 5 == 0:
            ret += 1
if cnt == ret:
    print('APPROVED')
else:
    print('DENIED')

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

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

A = []
ans = int(0)

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

for i in range(len(A)):
    x = A[i] % 3
    y = A[i] % 5
    if x != 0 and y != 0:
        ans += 1
        continue


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

Solution (Python):
n = int(input())
a = [int(x) for x 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:
    pass
  if i == n-1:
    print("APPROVED")

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

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

print(result)

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

Solution (Python):
n = int(input())
l = list(map(int, input().split()))
L = [i for i in l if i%2 == 0]
M = [i for i in L if i%3 == 0 or i%5 == 0]
if len(L) == len(M):
    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 = list(map(int, input().split()))

ans = 'APPROVED'
for i in range(0, n) :
  if a_list[i]%2 == 0 :
    if (a_list[i]%3)*(a_list[i]%5) != 0 :
      ans = 'DENIED'
      break
print(ans)

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

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

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

for j in B:
    if j % 3 != 0:
        if j % 5 != 0:
            x += 1

if x != 0:
    print('DENIED')
else:
    print('APPROVED')

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

isApproved = True
for i in range(N):
    if A[i] % 2 == 0:
        if A[i] % 3 != 0:
            if A[i] % 5 != 0:
                isApproved = False


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

Solution (Python):
num = int(input())
xs = [int(x) for x in input().split() if int(x) % 2 == 0]

approved = True
for x in xs:
  if x % 3 ==0 or x % 5 == 0:
    continue
  else:
    print("DENIED")
    approved = False
    break
    
if approved:
  print("APPROVED")

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

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

flg = True
for i in l:
    if i % 2:
        pass
    elif i % 3 == 0:
        pass
    elif i % 5 == 0:
        pass
    else:
        flg = False
        break
    
print('APPROVED' if flg else 'DENIED')

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

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

Solution (Python):


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

flag_d = 0 
flag_a = 0 
for a in alist:
    if a % 2 == 0:
        if a % 3 == 0 or a %5 == 0:
            flag_a += 1
        else:
            flag_d += 1

if flag_d >= 1:
    print('DENIED')
else:
    print('APPROVED')

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

even_list = [i for i in num_list if i % 2 == 0]

approved = True

for j in even_list:
    if (j % 3 != 0) and (j % 5 != 0):
        approved = False

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

Solution (Python):
n = input()
num = input().split()
flag = 0

for i in num:
    i = int(i)
    if i%2==0:
        if i%3 != 0 and i%5 != 0:
            flag = 1
if flag == 0:
    print("APPROVED")
else:
    print("DENIED")

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