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 = [int(i) for i in input().split()]

for i in range(N):
    if A[i] % 2 == 0:
        if (A[i] % 3 == 0) or (A[i] % 5 == 0):
            pass
        else:
            print('DENIED')
            exit()
print('APPROVED')

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

c=0

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

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

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


for i in a:
    if not i % 2 == 0:
        continue
    if i % 3 == 0 or i % 5 == 0:
        continue
    else:
        ans = 'DENIED'

print(ans)

Solution (Python):
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda x: [na() for _ in range(x)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda x: [ns() for _ in range(x)]
nas = lambda: stdin.readline().split()

n = ni()
a = na()

flag = True

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

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

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

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

Solution (Python):
from collections import defaultdict
from collections import deque
from string import ascii_uppercase
import sys, bisect, math, heapq

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
A = read_int()

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

if __name__ == "__main__":
    print(solve())

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

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


if __name__ == '__main__':
    main()

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

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

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

ans = "APPROVED"

for a in A:
  if a % 2 == 0:
    if (a % 3) * (a % 5) != 0:
      ans = "DENIED"
      
print(ans)

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
flag=0
for a in A:
    if flag==0 and a%2==0:
        if a%3==0 or a%5==0:
            flag=0
        else:
            flag=1

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

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

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

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

flag = 1
for a in A:
  if a % 2 == 0:
    if a % 3 == 0 or a % 5 == 0:
      continue
    else:
      flag = 0
print('APPROVED' if flag else 'DENIED')

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

flag_ok = True

As = [int(a) for a in input().split(' ')] 
for Ai in As:
	if Ai%2 == 0:
		if (Ai%3==0) or (Ai%5==0):
			pass
		else:
			flag_ok=False
	else:
		pass
      
if flag_ok:
	print('APPROVED')
else:
	print('DENIED')

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


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

print(ans)

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

ret = "APPROVED"

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

print(ret)

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

if __name__ == '__main__':
  run()

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

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

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

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

Solution (Python):
import sys

def main():
    flg=True
    input()
    tmp = input().replace('\n','').split()
    for i in tmp:
        i = int(i)
        if i%2 == 0:
            if i%3 != 0 and i%5 != 0:
                flg=False
                break
    if flg:
        print("APPROVED")
    else:
        print("DENIED")
if __name__ == '__main__':
    input = sys.stdin.readline
    main()

Solution (Python):

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

for x in li:
    if x % 2 == 0 and (x % 3 != 0 and x % 5 != 0):
        f = 0

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

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

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

for i in range(n):
    if ls[i] % 2 == 1:
        if i == n - 1:
            print("APPROVED")
    elif ls[i] % 2 == 0:
        if ls[i] % 3 == 0 or ls[i] % 5 == 0:
            if i == n - 1:
                print("APPROVED")
        else:
            print("DENIED")
            break

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

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

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
res = "APPROVED"
for x in a:
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
            pass
        else:
            res = "DENIED"
            break
print(res)

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

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

print(ans)

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

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

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

for x in H:
    if (x % 3 != 0) and (x % 5 !=0):
        print('DENIED')
        exit()
print('APPROVED')

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

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 or a%5==0:
      f = True
    else:
      f = False
      break

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

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


flag = True

for a in A:
    if a % 2 == 0:
        if not (a % 3 == 0 or a % 5 == 0):
            flag = False


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

Solution (Python):
import sys
n = int(input())
a = list(map(int, input().split()))
for i in a:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            print("DENIED")
            sys.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):
import sys

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

false_flag = 0

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

Solution (Python):
def solve(n, a):
    for a_i in a:
        if a_i % 2 == 1:
            continue
        if a_i % 3 != 0 and a_i % 5 != 0:
            print("DENIED")
            return
    print("APPROVED")

if __name__ == "__main__":
    n = int(input().strip())
    a = list(map(int, input().strip().split(" ")))

    solve(n, a)

Solution (Python):



import sys
input = sys.stdin.readline


def main():
    n = int(input())
    a = list()

    for i in map(int, input().split()):
        a.append(i)

    flag = True
    for i in a:
        if i % 2 == 0:
            if i % 3 == 0:
                continue
            elif i % 5 == 0:
                continue
            else:
                flag = False
                break

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


if __name__ == '__main__':
    main()

Solution (Python):
import sys
N=input()
A=map(int, sys.stdin.readline().split())

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

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

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


if __name__ == '__main__':
    main()

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):
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):
import sys
n = int(input())
a = list(map(int,input().split()))
even = []
for i in a:
    if i%2 == 0:
        if (i%3!=0) & (i%5!=0):
            print('DENIED')
            sys.exit()
print('APPROVED')

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

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

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

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

print("APPROVED")

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

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

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

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


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

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

f = True

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

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

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

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

for a in A:
    if a % 2 == 0:
        if a % 3 > 0 and a % 5 > 0:
            print("DENIED")
            break
else: print("APPROVED")

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

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

newA = []
for x in A:
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
            pass
        else:
            print('DENIED')
            exit()

print('APPROVED')

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
fl = True
for i in A:
    if i&1:
        continue
    else:
        if i%3!=0 and i%5!=0:
            fl = False
            break

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

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

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

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

Solution (Python):

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
A = read_ints()

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

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

Solution (Python):
'''
.append(要素) リストに要素を追加 
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
import itertools
from functools import reduce
from operator import mul


Num = int(stdin.readline().rstrip())
data = [int(s) for s in stdin.readline().rstrip().split()]
check = True
for el in data:
    if el % 2 == 0:
        if el % 3 != 0 and el % 5 != 0:
            check = False
if check:
    print('APPROVED')
else:
    print('DENIED')

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

flag = 0

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = 1 
            break

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

Solution (Python):
def solve():
    N = int(input())
    a_lst = [int(x) for x in input().split()]
    can = True
    for a in a_lst:
        if a%2 == 0:
            if a%3 == 0 or a%5 == 0:
                continue
            else:
                can = False
    return can
if __name__ == '__main__':
    print('APPROVED' if solve() == True else 'DENIED')

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

for i in range(n):
    if List[i] % 2 == 0 and (List[i] % 3 == 0 or List[i] % 5 == 0):
        continue
    elif List[i] % 2 != 0:
        continue
    else:
        flag = False
        break
        
if flag:
    print('APPROVED')
else:
    print('DENIED')

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

for i in even_A:
    if i % 3 != 0 and i % 5 != 0:
        answer = False

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

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

f = 0

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            continue
        else:
            f = 1

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

Solution (Python):


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

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

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

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

Solution (Python):

N = int(input())
A = list(map(int, input().split()))
t, f = [False for _ in range(N)], [False for _ in range(N)]
for i in range(N):
    if A[i] % 6 == 0: 
        t[i] = True
    if A[i] % 10 == 0:
        f[i] = True
    if A[i] % 2 == 1:
        t[i] = True
        f[i] = True
flag = True
for i in range(N):
    if not t[i]:
        if not f[i]:
            flag = False
print("APPROVED" if flag else "DENIED")

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

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

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

flag = True
for a in A:
    if (a%2)!=0:
        continue
    else:
        if(a%3)==0:
            continue
        elif(a%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()))

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

Solution (Python):
def run():
    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")
                return
    
    print("APPROVED")
    

if __name__ == "__main__":
    run()

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

flag = 'APPROVED'
for i in a_list:
    if i % 2 == 0:
        if not (i % 3 == 0 or i % 5 == 0):
            flag = 'DENIED'

print(flag)

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

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

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

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

logic = True
for a in A:
    logic &= ((a % 2 == 1) or (a % 3 == 0 or a % 5 == 0))

print("APPROVED\n" if logic else "DENIED\n")

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

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())
As = list(map(int,(input().split())))
As_even = [e for e in As if e % 2 == 0]

for A in As_even:
    if not(A % 3 == 0 or A % 5 == 0):
        print('DENIED')
        exit()
        

print('APPROVED')

Solution (Python):
n = int(input())
numlist = [int(i) for i in input().split()]
oddnum = [j for j in numlist if j%2 == 0]
checknum = [k for k in oddnum if k%3 == 0 or k%5 == 0]
if len(oddnum) == len(checknum) :
    print("APPROVED")
else :
    print("DENIED")

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

flag = True

for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            flag = False

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

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

approvedFlag = True

for a in A:
	if a%2 == 0:
		if (a%3!=0) and (a%5!=0):
			approvedFlag = False
			break

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

Solution (Python):
def resolve():
    n = int(input())
    a = list(map(int, input().split()))
    l = [x for x in a if x % 2 == 0 and x % 3 != 0 and x % 5 != 0]
    print("APPROVED" if not l else "DENIED")


if __name__ == '__main__':
    resolve()

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()
    else:
        continue
        
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")
            exit()

print("APPROVED")

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

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

Solution (Python):
n = int(input())
a = map(int, input().split())
is_ok = True
for num in a:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 == 0:
            
            continue
        else:
            
            is_ok = False
            break

if is_ok:
    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

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

Solution (Python):



N = int(input())
A = list(map(int, input().split()))
approved = True
for i in range(N):
    a = A[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())
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())
alist=list(map(int,input().split()))
ans="APPROVED"
for i in range(n):
    if alist[i]%2==0:
        if alist[i]%3!=0 and alist[i]%5!=0:
            ans="DENIED"
            break
print(ans)

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

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

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

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

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

print(ans)

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

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

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

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
ans = []
for i in a:
  if i % 2 == 0:
    ans.append(i)

for i in ans:
  if i %3 == 0 or i %5 ==0:
    pass
  else:
    print('DENIED')
    quit()

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

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

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

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians

from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7


def main():
    N = INT()
    A = LIST()

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

    print("APPROVED")


if __name__ == '__main__':
    main()

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 or a[i]%5==0:
      pass
    else:
      flg=1
      print('DENIED')
      break

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

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