program answer
  implicit none
  integer :: N, i
  integer, allocatable :: A(:)
  read(*,*) N
  allocate(A(N))
  read(*,*) A

  do i = 1, n
     if(mod(A(i),2)==0) then
        if(mod(A(i),3)/=0.and.mod(A(i),5)/=0) then
           write(*,*) 'DENIED'
           stop
        end if
     end if
  end do

  write(*,*) 'APPROVED'

  deallocate(A)
  stop
 end program answer
