#!/bin/bash

read hm
read input
arr=($(echo $input | tr ' ' "\n"))
unset evens
declare -a evens


for i in "${!arr[@]}"; do
    mod=$((${arr[i]}%2))
    if [[ mod -eq 0 ]]; then
        evens=(${evens[@]} ${arr[i]})
    fi
done
for j in ${evens[@]}; do
    res3=$((${j}%3))
    res5=$((${j}%5))
    if [[ $res3 -ne 0 ]] && [[ $res5 -ne 0 ]];then
        echo DENIED

        exit
    fi
done
if [[ $evens == '' ]]; then echo DENIED;exit; fi
echo APPROVED

