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):
def hantei(N):
    if N % 2 == 0:
        if N % 3 == 0 or N % 5 == 0:
            return True
        else:
            return False
    else:
        return True

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

for i in A:
    if hantei(i):
        continue
    else:
        print("DENIED")
        break
else:
    print("APPROVED")

Solution (Python):
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))


n=ni()
a = nl()
j= True

for i in a:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            j=False
            


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

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

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

Solution (Python):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
A = iil()

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()))
j,c=0,0

for i in a:
    if i%2==0:
        j+=1
        if i%3==0:
            c+=1
        elif i%5==0:
            c+=1
    else :
        continue



if c==j:
    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 and (A[i] % 3 != 0 and A[i] % 5 != 0):
        flag = False
        break

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

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

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

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

Solution (Python):
x = input()
li = list(map(int,input().split()))
s =[]
for i in range(len(li)):
    if li[i] % 2 == 0:
        s.append(li[i])
o = True
for k in range(len(s)):
    if s[k] % 3 != 0 and s[k] % 5 != 0:
        o = False
    else:
        continue
if o:
    print('APPROVED')
else:
    print('DENIED')

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

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

    print('APPROVED')


if __name__ == '__main__':
    main()

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

for a in aa:
    if a % 2 == 0 and not (a % 3 == 0 or a % 5 == 0):
        print("DENIED")
        exit(0)
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 = [int(x) for x in input().split()]

flag = ""

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

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

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

str = "APPROVED"
for a in ai:
    if a % 2 != 0:
        continue
    
    if a % 3 != 0 and a % 5 != 0:
        str = "DENIED"
        break

print(str)

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

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

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

Solution (Python):
N=int(input())
A=[int(s) for s in 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()))
B=[]
r="APPROVED"
for i in range(N):
    if A[i]%2==0 and A[i]%3!=0 and A[i]%5!=0:
        r="DENIED"
        break
print(r)

Solution (Python):
def ng(n):
    return not n%2 and n%3 and n%5
n = input()
print('DENIED' if any(ng(int(i)) for i in input().split()) else 'APPROVED')

Solution (Python):
def ng(n):
    return n%2==0 and n%3!=0 and n%5!=0
n = input()
print('DENIED' if any(ng(int(i)) for i in input().split()) else 'APPROVED')

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

for i in a:
  if i%2==1:
    continue
  elif i%3==0:
    continue
  elif i%5==0:
    continue
  else:
    print("DENIED")
    x = 1
    break
    
if x == 0:
  print("APPROVED")

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

for i in range(N):

    if c[i]%2==0:
        if c[i]%3==0 or c[i]%5==0:
            continue

        else:
            print("DENIED")
            exit(0)

print("APPROVED")

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

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

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

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

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

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

Solution (Python):
N = input()
A = [int(x) for x in 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()))
A_even=[i for i in A if i%2==0]
ans=1
for i in A_even:
  if i%3!=0 and i%5!=0:
    ans=0
    break
if ans==1:
  print("APPROVED")
else:
  print("DENIED")

Solution (Python):
import numpy as np

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

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()))
B = []

for item in A:
    if item%2==0:
        B.append(item)
cnt = 0
ans = ''
for item in B:
    if item%3!=0:
        if item%5!=0:
            ans = 'DENIED'
if ans!='DENIED':
    ans = 'APPROVED'
print(ans)

Solution (Python):

N = int(input())
A = list(map(int,input().split()))
count = 0
for i in A:
    if i%2==0:
        if i%3 == 0 or i%5 == 0:
            pass
        else:
            count+=1
if count==0:
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
import sys

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

for x in X :
    if x%2==0:
        if x%3==0 or x%5 ==0:
            pass
        else :
            print('DENIED')
            sys.exit()
    else :
        pass

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 i in a:
    if i%2==0 and i%3!=0 and i%5!=0:
        print('DENIED')
        exit()
print('APPROVED')

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

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

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

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

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) * (A[i] % 5) != 0:
            ans += 1

print("DENIED" if ans >= 1 else "APPROVED")

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

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

else:
    print("DENIED")

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

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

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

Solution (Python):


n = int(input())

input_data = list(map(int, input().split()))[0:n]


isApproved = True


for index, item in enumerate(input_data):
    
    if item % 2 == 0 and item % 3 != 0 and item % 5 != 0:
        isApproved = False


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

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

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

ans = 'APPROVED' if check(a) else 'DENIED'
print(ans)

Solution (Python):
n = int(input())
numbers = list(map(int, input().split()))
flg = True
for number in numbers:
    if number % 2 == 0 and number % 3 != 0 and number % 5 != 0:
        flg = False
        break

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

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

ans = 0

for i in range(n):
  ai = a[i]
  if ai % 2 == 0:
    if (ai % 3) * (ai % 5) != 0:
      ans += 1
      
if ans >= 1:
  print('DENIED')
else:
  print('APPROVED')

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

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

A_ = [a for a in A if a % 2 == 0 and a % 3 != 0 and a % 5 != 0]

if len(A_) > 0:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):

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


gusu =[i for i in A if i % 2 ==0]
x = 0
for i in gusu:
    if i % 3 ==0 or i % 5 ==0:
            x += 1          
if len(gusu) == x:
    print("APPROVED")
else:
    print("DENIED")

Solution (Python):
import sys

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

for i in range(N):
    if nlist[i]%2 == 0:
        if nlist[i]%3 != 0 and nlist[i]%5 != 0:
            print('DENIED')
            sys.exit()

print('APPROVED')

Solution (Python):
print("APPROVED"if int(input())==sum([1 for e in[int(a)for a in input().split(" ")]if not(e%2==0 and e%3!=0 and e%5!=0)])else"DENIED")

Solution (Python):
print("APPROVED" if int(input()) == sum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)]) else "DENIED")

Solution (Python):
n = int(input())
x = sum([1 for e in [int(a) for a in input().split(" ")] if not(e % 2 == 0 and e % 3 != 0 and e % 5 != 0)])
print("APPROVED" if n == x else "DENIED")

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

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

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

Solution (Python):
'''
    Auther: ghoshashis545 Ashis Ghosh
    College: jalpaiguri Govt Enggineerin College
    Date:24/03/2020
'''

def main():
    
    
    n=int(input())
    a=list(map(int,input().split()))
    f=0
    for i in a:
        if(i%2==0):
            if(i%3!=0 and i%5!=0):
                f=1
                break
    if(f):
        print('DENIED')
    else:
        print('APPROVED')
        
















    
    
if __name__ =="__main__":
    main()

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


A = [a for a in _A if (a % 2 == 0)]

ans = [a for a in A if (a % 3 == 0 or a % 5 == 0)]

print("APPROVED" if len(A) == len(ans) else "DENIED")

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

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

def cal(n):
    count = 0
    for i in range(len(n)):
        if n[i] % 2 == 0:
            if n[i] % 3 == 0 or n[i] % 5 == 0:
                count += 1
        else:
            count += 1
    if count == len(n):
        print("APPROVED")
    else:
        print("DENIED")
cal(n)

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

flg = 0
for i in range(n):
    if a[i - 1] % 2 == 0:
        if (a[i - 1] % 3 == 0) or (a[i - 1] % 5 == 0):
            continue
        else:
            flg += 1
if flg > 0:
    print("DENIED")
else:
    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:
         continue
      if a % 5 == 0:
         continue
      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 not ((i % 3 == 0) or (i % 5 == 0)):
      print("DENIED")
      break
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())
number=[int(i) for i in input().split()]

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

Solution (Python):
n = int(input())
list_num = list(map(int, input().split()))
flg = False
for i in range(n):
  if list_num[i] % 2 == 1 or (list_num[i] % 2 == 0 and (list_num[i] % 3 == 0 or list_num[i] % 5 == 0)):
    flg = True
  else:
    flg = False
    break

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

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

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

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

Solution (Python):

x = int(input())

n = []


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

def cal(n):
    count = 0
    for i in range(len(n)):
        if n[i] % 2 == 0:
           if n[i] % 3 == 0 or n[i] % 5 == 0:
                count += 1
        else:
            count += 1
    if count == len(n):
        print("APPROVED")
    else:
        print("DENIED")

cal(n)

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

flag = True
for i in A:
    if i%2 == 0:
        if i%3 != 0 and i%5 != 0:
            flag = False
            break

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

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

x = 0

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

if x == 0:
    print("APPROVED")
elif x == 1:
    print("DENIED")

Solution (Python):
def main():
    N = int(input())
    A = list(map(int,input().split()))
    i = 0
    while i < N:
        if A[i] % 2 == 0:
            if (A[i] % 3) != 0 and (A[i] % 5) != 0:
                return("DENIED")
                break
        i += 1
    return("APPROVED")
print(main())

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

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

i = 0
A = input().split()
ans = 'APPROVED'

while i < N:
  a = A[i]
  if int(a) % 2 == 0:
    if not ((int(a) % 5 == 0) or (int(a) % 3 ==0)):
      ans = 'DENIED'

  if ans == 'DENIED':
    break

  i += 1

print(ans)

Solution (Python):
N = int(input())
lst = input().split(' ')
for v in lst:
  good = False
  if int(v) % 2 != 0:
    good = True
  elif int(v) % 3 != 0 and int(v) % 5 != 0:
    print('DENIED')
    break
  else:
    good = True
if good:
  print('APPROVED')

Solution (Python):
N = int(input())
A = map(int,input().split())
A_even = [i for i in A if i % 2 == 0]
baisuu = [i for i in A_even if i % 3 == 0 or i % 5 == 0]
if A_even == baisuu:
    print("APPROVED")
else:
    print("DENIED")

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

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

if check == 0 :
  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] % 3 != 0 and a[i] % 5 != 0:
      flag = 1
print("APPROVED") if flag == 0 else print("DENIED")

Solution (Python):
N=int(input())
A=list(map(int,input().strip().split()))
def border_judge(N,A):
    judge=True
    for n in range(len(A)):
        if A[n]%2==0:
            if A[n]%5==0 or A[n]%3==0:
                judge=True
            else:
                judge=False
                break
        else:
            pass

    if judge==True:
        return "APPROVED"
    elif judge==False:
        return "DENIED"

print(border_judge(N,A))

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

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

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

Solution (Python):


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

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

print("APPROVED")

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

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

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

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

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

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

flag = False
for x in xs:
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
            pass
        else:
            flag = True
            break

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

print('APPROVED')

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

cnt=0
for value in data:
    if value%2==0:
        if (value % 3 ==0) or (value % 5 == 0):
            None
        else:
            cnt+=1

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

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

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

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

Solution (Python):

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

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

def chk_valid(i):
    if i % 2 == 1:
        return False
    if i % 3 == 0 or i % 5 == 0:
        return False
    return True

f = filter(chk_valid, l)
print('APPROVED' if len(list(f)) == 0 else 'DENIED')

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

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

Solution (Python):
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')
            exit()
print('APPROVED')

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

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

if len(B)==0:
    res='APPROVED'
if 0<len(B):
    for b in B:
        if (b%3!=0)&(b%5!=0):
            res='DENIED'
print(res)

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

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


if __name__ == "__main__":
    main()

Solution (Python):

''' ===========================================



=========================================== '''
import sys
from sys import stdin 
input = stdin.readline
import heapq 
sys.setrecursionlimit(10**6)
INF = 1<<50

if __name__ == '__main__':
    n = int(input())
    
    chk = True;
    
    iip = list(map(int, input().split(' ')))
    for i in range(n):
        a = iip[i]
        if a&1 == 0:
            if a%3 == 0 or a%5 == 0:
                continue;
            else:
                chk = False;
                break;
        else:
            continue;
    
    if chk == True:
        print("APPROVED")
    else:
        print("DENIED")

Solution (Python):
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().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())
ls = map(int, input().split())
a = []
b = 0
for i in ls:
    if i % 2 == 0:
        a.append(i)
    else:
        continue
for j in a:
    if (j % 3 == 0) or (j % 5 == 0):
        b += 1
    else:
        continue
if b == len(a):
    print('APPROVED')
else:
    print('DENIED')

Solution (Python):
def im():
    a=int(input())
    b=input()
    b=b.split()
    b1=list(map(int,b))
    for i in b1:
        if i%2==0 and i%3!=0  and i%5!=0:
            return "DENIED"
    return "APPROVED"
print(im())

Solution (Python):
x=int(input())
y=input()
z=y.split()
e=0
for i in z:
    w=int(i)
    if w%2 == 0:
        if w%5 == 0:
            continue
        elif w%3 ==0:
            continue
        else:
            e=1
        
if e == 1:
    print("DENIED")
else:
    print("APPROVED")

Solution (Python):
n=int(input())
A=list(map(int,input().split()))
for i in A:
  if i%2==1 or i%6==0 or i%10==0:
    continue
  print("DENIED")
  exit()
print("APPROVED")

Solution (Python):
import os

def main():
    count = int(input())
    NumList = list(map(int, input().split()))
    ansList = []
    ansCount = 0

    for num in NumList:
        if num % 2 == 0:
            ansList.append(num)
            if ((num % 3 == 0) or (num % 5 == 0)):
                ansCount += 1
            else:
                pass
        else:
            pass

    if len(ansList) != ansCount:
        print("DENIED")
    else:
        print("APPROVED")

if __name__ == "__main__":
    main()

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

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

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

print('APPROVED')

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

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

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

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

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
approve=0
for k in range(0,n):
  if a[k]%2==0:
    if (a[k]%3==0)or(a[k]%5==0):
      approve=approve+0
    else:
      approve=approve+1

if approve==0:
  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 and i%3!=0 and i%5!=0:
        ans='DENIED'
    
print(ans)

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

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

if flag is True:
  print('APPROVED')
else:
  print("DENIED")

Solution (Python):

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

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

flg = True
cnt = 0
for i in range(N):
  if (A[i] % 2) == 0:
    cnt += 1
    if (A[i] % 3) != 0 and (A[i] % 5) != 0:
      flg = False
      break
if cnt == 0 or flg:
  print('APPROVED')
else:
  print('DENIED')

Solution (Python):
n = int(input())
num = list(map(int, input().split()))
flg = False
num2 = []
for i in range(n):
    if num[i] % 2 == 0:
        num2.append(num[i])

for j in range(len(num2)):
    if len(num2) == 0:
        flg = True
        break        
    elif num2[j] % 3 == 0 or num2[j] % 5 == 0:
        continue
    else:
        flg = True
        break


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

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

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

Solution (Python):

import numpy as np

N= int(input())


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


flag=True


for num in range(N):
    q, mod = divmod(list[num], 2)
    if mod==0:
        q, mod3 = divmod(list[num], 3)
        q, mod5 = divmod(list[num], 5)
        if mod3!=0 and mod5!=0:
           flag=False


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

Solution (Python):
N = int(input())
Af = list(map(int,input().split()))
A = list()
for i in range(N):
  if Af[i] % 2 == 0:
      A.append(Af[i])
      continue
  else:
      continue
for i in range(len(A)):
  if A[i] % 3 != 0 and A[i] % 5 != 0:
      print('DENIED')
      import sys
      sys.exit()
  if A[i] % 3 == 0 or A[i] % 5 == 0:
      continue 
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:
    print('APPROVED')
else:
    print('DENIED')

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

Solution (Python):

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

ret = "APPROVED"

for i in b:
    if i%2==0:
        if i%3!=0 and i%5!=0:
            ret = "DENIED"
            break
print(ret)

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