s = input()
n1 = int(s[0:2])
n2 = int(s[2:4])

if 1 <= n1 <= 12:
  if 1 <= n2 <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif 1 <= n2 <= 12:
  print('YYMM')
else:
  print('NA') s = input() s input() input n1 = int(s[0:2]) n1 int(s[0:2]) int s[0:2] s 0:2 0 2 n2 = int(s[2:4]) n2 int(s[2:4]) int s[2:4] s 2:4 2 4 if 1 <= n1 <= 12:
  if 1 <= n2 <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif 1 <= n2 <= 12:
  print('YYMM')
else:
  print('NA') 1 <= n1 <= 12 1 <= n1 1 n1 12 if 1 <= n2 <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY') 1 <= n2 <= 12 1 <= n2 1 n2 12 print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' elif 1 <= n2 <= 12:
  print('YYMM') 1 <= n2 <= 12 1 <= n2 1 n2 12 print('YYMM') print 'YYMM' print('NA') print 'NA' n1 = int(s[0:2]) int(s[0:2]) n1 n2 = int(s[2:4]) int(s[2:4]) n2 s = input() input() s
s = input()
n1 = int(s[0:2])
n2 = int(s[2:4])

if 1 <= n1 <= 12:
  if 1 <= n2 <= 12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif 1 <= n2 <= 12:
  print('YYMM')
else:
  print('NA')
