program main
        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) .or. (mod(a(i),5) == 0) ) then
            else
              print *, 'DENIED'
              stop
            end if
          end if
        end do

        print *, 'APPROVED'
end program main
