program papers_please
  implicit none
  integer :: n, a(100) = 0, i
  read(*,*) n
  read(*,*) a(1:n)
  do i = 1, n
    if (mod(a(i),2) /= 0) cycle
    if (mod(a(i),3)*mod(a(i),5) == 0) cycle
    write(*,'(a)') "DENIED"
    stop
  end do
  write(*,'(a)') "APPROVED"
end program papers_please