program main implicit none integer::N character*3::S read *,N if(N.ge.4) then print '(a)',"YES" else if(N.eq.1) then print '(a)',"NO" else if(N.eq.2) then read *,S if(S(1:1).eq.S(2:2)) then print '(a)',"YES" else print '(a)',"NO" end if else if(N.eq.3) then read *,S if(S(1:1).eq.S(3:3).and.S(1:1).ne.S(2:2)) then print '(a)',"NO" else print '(a)',"YES" end if end if end program main