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

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    A = i2nn()
    for a in A:
        if a % 2 == 0 and (a % 3 and a % 5):
            print('DENIED')
            return
    else:
        print('APPROVED')
    return

main()

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    a = [int(i) for i in input().split()]
    count = 0


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

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

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

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

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

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

print(func(A))

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

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

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

ans = 'APPROVED'

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

print(ans)

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:
            pass
        else:
            flag = False
            break

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

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

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

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

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

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

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

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

print(ans)

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

Solution (Python):
import sys 
import heapq 
from collections import defaultdict
fastinp = lambda: sys.stdin.readline().split(' ')
inp = lambda: input().split(' ')
ml = lambda x, y=int: list(map(y, x))
debug = lambda *args: print(*args, sep=' | ')
n = int(inp()[0])
nums = ml(inp())
flag = True
for num in nums:
    if num%2 == 0:
        if num%3 == 0 or num%5 == 0:
            continue
        else:
            flag = False
            break
if not flag:
    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==0:
    if A[i]%3==0 or A[i]%5==0:
      ans="APPROVED"
    else:
      print("DENIED")
      exit()

print(ans)

Solution (Python):
_ = input()
a = list(map(int, input().split()))
ans = 'APPROVED'
for num in a:
    if num % 2 == 0:
        if num % 3 == 0:
            continue
        elif num % 5 == 0:
            continue
        else:
            ans = 'DENIED'
            break

print(ans)

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

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

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

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

    for x in A:
        if x % 2 == 0:
            if (x % 3 == 0) or (x % 5 == 0):
                continue
            else:
                print('DENIED')
                quit()

    print('APPROVED')





if __name__ == "__main__":
    main()

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

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

if flag == 0:
    print("DENIED")
else:
    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])
for i in range(len(b)):
    if b[i] % 3 !=0 and b[i] % 5 != 0:
        print("DENIED")
        exit()
print("APPROVED")

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

ans = True

for a in la:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            ans = False

if ans:
    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())
a = list(map(int, input().strip().split()))

count = 0
for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            count += 1
        else:
            print('DENIED')
            exit()

print('APPROVED')

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

n = int(input())
a = [int(i) for i in input().split()]

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

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

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

Solution (Python):
def main(n, a):
    for i in a:
        if i % 2 == 0:
            if i % 3 != 0 and i % 5 != 0:
                print("DENIED")
                return

    print("APPROVED")


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

    main(n, a)

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

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




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

flg=True
for i in a:
    if i%2==0:
        if not (i%3==0 or i%5==0):
            flg=False;break
        else:
            flg=True
    


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

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

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

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

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

print('APPROVED ')

Solution (Python):
N = input()
AN = input().split()
AN = [int(a) for a in AN if int(a) % 2 == 0]
den = [a for a in AN if a % 3 != 0 and a % 5 != 0]


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

Solution (Python):
def main():
    n = int(input())
    As = list(map(int, input().split(" ")))

    ans = "APPROVED"
    for a in As:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                ans = "DENIED"
                break

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):
n = int(input().rstrip())
As = map(int, input().rstrip().split(" "))

response = "APPROVED"

for a in As:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            response = "DENIED"
            break

print(response)

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

Solution (Python):
N = int(input())
A = [int(i) for i in input().split()]
ans = True
for a in A:
    if a % 2 == 0:
        if not(a % 3 == 0 or a % 5 == 0):
            ans = False
            break
print('APPROVED' if ans else 'DENIED')

Solution (Python):
n = int(input())
nums = list(map(int, input().split()))
flag = 1
for i in nums:
    if i % 2 == 0:
        if i % 3 != 0 and i % 5 != 0:
            flag = 0

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

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

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

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

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

if len([x for x in nums if (x % 2 == 0) and (x % 3 > 0 and x % 5 > 0)]) >= 1:
	print("DENIED")
else:
	print("APPROVED")

Solution (Python):

from collections import deque

def comb(a, b):
    result = 1
    for i in range(b):
        result *= (a - i) / (i + 1)
    return result


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

    is_valid = True
    for A in As:
        if A % 2 == 0:
            if A % 3 == 0 or A % 5 == 0:
                pass
            else:
                is_valid = False

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


if __name__ == '__main__':
    main()

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

even = [a for a in a_list if a % 2 == 0]
result = True
for num in even:
    if num % 3 > 0 and num % 5 > 0:
        result = False

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

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

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

print(ans)

Solution (Python):



n = int(input())
a = [int(x) for x in input().split() if int(x) % 2 == 0]
for x in a:
    if not (x % 3 == 0 or x % 5 == 0):
        print("DENIED")
        exit()
print("APPROVED")

Solution (Python):

import sys

N = int(input())
A = [int(i) for i in input().split()]

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

print('APPROVED')

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

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

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

res = 0

for i in even_list:
  if i % 3 == 0:
    res += 1
  elif i % 5 == 0:
    res += 1
if res == len(even_list):
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):


import sys
import math
import itertools

def main():
    n = int(sys.stdin.readline())
    xs = map(int, sys.stdin.readline().split())

    for x in xs:
        if x % 2 == 0 and (x % 3 != 0 and x % 5 != 0):
            print('DENIED')
            return
    print('APPROVED')

if __name__ == '__main__':
    main()

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def MI(): return map(int, input().split())


def S(): return input()


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


YN = {False: 'No', True: 'Yes'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False



def main():
    N = I()
    a = LI()
    cnt = 0

    for i in range(N):
        if a[i] % 2 == 0 and (a[i] % 3 == 0 or a[i] % 5 == 0):
            cnt += 1
        elif a[i] % 2 == 1:
            cnt += 1

    if cnt == N:
        print('APPROVED')
    else:
        print('DENIED')


if __name__ == '__main__':
    main()

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

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

Solution (Python):


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

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

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

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

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

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

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = 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
            break

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

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

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

flag = True
for num in nums:
    if num % 2 == 0:
        if num % 3 == 0 or num % 5 == 0:
            continue
        else:
            flag = False

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

Solution (Python):
n = int(input())
v = list(map(lambda x: int(x), input().split(" ")))
ok = True
for i in v:
    if i % 2 == 0:
        if i % 3 == 0:
            continue
        elif i % 5 == 0:
            continue
        else:
            ok = False
            break
print("APPROVED" if ok else "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) or (A[i] % 5 == 0):
            pass
        else:
            f = False
            break
if f:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
n = 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)

print('APPROVED')

Solution (Python):
N=input()
A = map(int, input().split())
B=filter(lambda x: x % 2 == 0,A)
for b in B:
  if b%3==0 or b%5==0:
    continue
  print('DENIED')
  break
else:
  print('APPROVED')

Solution (Python):
from sys import stdin

if __name__ == '__main__':
    N = int(stdin.readline().rstrip())
    A = [int(x) for x in stdin.readline().rstrip().split()]
    result = 'APPROVED'
    for a in A:
        if a % 2 == 0:
            if a % 3 == 0 or a % 5 == 0:
                pass
            else:
                result = 'DENIED'
                break
    print(result)

Solution (Python):
N = int(input())
array = map(int, input().split())
for a in array:
    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()]

flag = True
for a in A:
    if a%2==0 and not(a%3==0 or a%5==0):
        flag = False
        break
        
if flag:
    print("APPROVED")
else:
    print("DENIED")

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


for i in range(N):
    if A[i]%2 ==0:
        n += 1
        if A[i]%3 ==0 or  A[i]%5 ==0:
            count += 1

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

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

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

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

Solution (Python):
def main(n,a):
    for i in range(len(a)):
        if a[i] % 2 != 0:
            continue
        else:
            if (a[i] % 3 == 0) or (a[i] % 5 == 0):
                continue
        return False
    return True

n = int(input())
a = list(map(int, input().split()))
print("APPROVED" if main(n,a) else "DENIED")

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

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

Solution (Python):
n = int(input())
a = list(map(int,input().split()))
ans = "APPROVED"
b=0
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())
li = list(map(int,input().split()))
cnt1, cnt2 = 0,0
for i in li:
    if i % 2 == 0:
        cnt1 += 1
        if i % 3 == 0 or i % 5 == 0:
            cnt2 += 1
if cnt1==cnt2:
    print("APPROVED")
else:
    print("DENIED")

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

ans = 'APPROVED'
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            continue
        else:
            ans = 'DENIED'
            break

print(ans)

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

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

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

print("APPROVED")

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

Solution (Python):
def resolve():
    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:
                pass
            else:
                flag = False

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

if __name__ == "__main__":
    resolve()

Solution (Python):

N = 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")
            break
else:
    print("APPROVED")

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

    a = list(filter(lambda x: (x%2 == 0), A))

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

main()

Solution (Python):
import sys
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

N = In()
A = InMap()

res = False
for num in A:
    if(num % 2 == 1):
        continue
    if(num % 3 != 0 and num % 5 != 0):
        res = True

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

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

for i in range(len(a_list)):
  if a_list[i]%2==0:
    if a_list[i]%3!=0 and a_list[i]%5!=0:
      print('DENIED')
      break
    
  if i==len(a_list)-1:
     print('APPROVED')

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

    for num in l:
        if num % 2 == 0:
            if num % 3 != 0 and num % 5 != 0:
                print('DENIED')
                return

    print('APPROVED')

resolve()

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

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

print("APPROVED")

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

count = 0
ans = 0
for i in range(N):
  if A[i] % 2 == 0:
    count += 1
  if A[i] % 6 == 0 or A[i] % 10 == 0:
    ans += 1

print("APPROVED" if count == ans 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()))
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 = [int(x) for x in input().split()]

flg = False

for a in a_list:
  if a%2==0:
    if a%3!=0 and a%5 !=0:
      flg = True
      break

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

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

for i in a_list:
  if i % 2 == 0:
    if i % 3 != 0 and i % 5 != 0:
      ans = "DENIED"

print(ans)

Solution (Python):




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

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

    if flag == True:
        print('APPROVED')
    else:
        print('DENIED')
    pass

if __name__ == '__main__':
    main()

Solution (Python):

N=int(input())

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

s=0
for i in range(len(A)):
    if (A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0):
        s=s+1
if s==0:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):


N = int(input().split()[0])
a_list = list(map(int, input().split()))
e_list = [a for a in a_list if a % 2 == 0]

if not e_list:
    ans = "APPROVED"
else:
    ee_list = [e for e in e_list if e % 3 == 0 or e % 5 == 0]
    ans = "APPROVED" if len(ee_list) == len(e_list) else "DENIED"

print(ans)

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

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

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(0)
print('APPROVED')

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

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

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

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

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

Solution (Python):
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 and a[i] % 5 != 0:
                ans = 'DENIED'
                break

    print(ans)


main()

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:
            flag = True
        elif i%5 == 0:
            flag = True
        else:
            flag = False
            break
            
if flag:
    print('APPROVED')
else:
    print('DENIED')

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

flag = 1

for i in a:
    if i%2 == 0:
        if i%3 == 0:
            pass
        elif i%5 == 0:
            pass
        else:
            flag = 0

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

Solution (Python):
import sys
input=sys.stdin.readline
def main():
    N=int(input())
    A=list(map(int,input().split()))
    flag=True
    for i in range(N):
        if A[i]%2==0:
            if A[i]%3==0 or A[i]%5==0:
                pass
            else:
                flag=False
                break
    if flag:
        print("APPROVED")
    else:
        print("DENIED")
if __name__=="__main__":
    main()

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

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

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

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

Solution (Python):
s=int(input())
N=map(int,input().split())
guu=[]
wari=[]
for i in N:
    if i%2==0:
        guu.append(i)
        if i%3==0 or i%5==0:
            wari.append(i)
        else:
            print('DENIED')
            exit()
print('APPROVED')

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


flag = False
for count in range(0,N):
    if A[count] % 2 == 0:
        if A[count] % 3 != 0 and A[count] % 5 != 0:
            flag = True

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

Solution (Python):
import sys

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

for i in range(len(a)):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            pass
        else:
            print("DENIED")
            sys.exit(0)
print("APPROVED")

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

print(s)

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

def check():
    for a in A:
        if a%2 == 0 and not(a%3 == 0 or a%5 == 0):
            print("DENIED")
            return

    print("APPROVED")
        
check()

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

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

Solution (Python):



from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

yes = 'APPROVED'
no = 'DENIED'

def main():
    n = ii()
    a = li()
    for i in range(n):
        flag = False
        if not a[i] %2:
            if not a[i] %3:
                flag = True
            if not a[i] %5:
                flag = True
        else:
            flag = True
        if not flag:
            print(no)
            exit()
    print(yes)
    
main()

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

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

  if i == len(a) -1:
    print("APPROVED")