PROGRAM ATCODER

implicit none
integer :: s,c1=0,c2=0

read*, s

if ( mod(s,100) >= 1 .and. mod(s,100) <= 12  ) then
  c1 = 1
end if

if ( s/100 >= 1 .and. s/100 <= 12 ) then
  c2 = 1
end if

if ( c1 == 1 .and. c2 == 1 ) then
  print'(a)', 'AMBIGUOUS'
end if

if ( c1 == 1 .and. c2 == 0 ) then
  print'(a)', 'YYMM'
end if

if ( c1 == 0 .and. c2 == 1 ) then
  print'(a)', 'MMYY'
end if

if ( c1 == 0 .and. c2 == 0 ) then
  print'(a)', 'NA'
end if

END PROGRAM ATCODER