s=input()

first_two=int(''.join(s[:2]))
last_two=int(''.join(s[2:]))

if 1<=first_two<=12 and 1<=last_two<=12:
  print('AMBIGUOUS')
elif 1<=last_two<=12:
  print('YYMM')
elif 1<=first_two<=12:
  print('MMYY')
else:
  print('NA') s=input() s input() input first_two=int(''.join(s[:2])) first_two int(''.join(s[:2])) int ''.join(s[:2]) ''.join '' join s[:2] s :2 2 last_two=int(''.join(s[2:])) last_two int(''.join(s[2:])) int ''.join(s[2:]) ''.join '' join s[2:] s 2: 2 if 1<=first_two<=12 and 1<=last_two<=12:
  print('AMBIGUOUS')
elif 1<=last_two<=12:
  print('YYMM')
elif 1<=first_two<=12:
  print('MMYY')
else:
  print('NA') 1<=first_two<=12 and 1<=last_two<=12 1<=first_two<=12 1<=first_two 1 first_two 12 1<=last_two<=12 1<=last_two 1 last_two 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1<=last_two<=12:
  print('YYMM') 1<=last_two<=12 1<=last_two 1 last_two 12 print('YYMM') print 'YYMM' elif 1<=first_two<=12:
  print('MMYY') 1<=first_two<=12 1<=first_two 1 first_two 12 print('MMYY') print 'MMYY' print('NA') print 'NA' last_two=int(''.join(s[2:])) int(''.join(s[2:])) last_two s=input() input() s first_two=int(''.join(s[:2])) int(''.join(s[:2])) first_two
s=input()

first_two=int(''.join(s[:2]))
last_two=int(''.join(s[2:]))

if 1<=first_two<=12 and 1<=last_two<=12:
  print('AMBIGUOUS')
elif 1<=last_two<=12:
  print('YYMM')
elif 1<=first_two<=12:
  print('MMYY')
else:
  print('NA')