n = int(input())

r = n // 100
l = n % 100

if r <= 12 and 1 <= r:
  if l <= 12 and 1 <= l:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if l <= 12 and 1 <= l:
    print("YYMM")
  else:
    print("NA") n = int(input()) n int(input()) int input() input r = n // 100 r n // 100 n 100 l = n % 100 l n % 100 n 100 if r <= 12 and 1 <= r:
  if l <= 12 and 1 <= l:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if l <= 12 and 1 <= l:
    print("YYMM")
  else:
    print("NA") r <= 12 and 1 <= r r <= 12 r 12 1 <= r 1 r if l <= 12 and 1 <= l:
    print("AMBIGUOUS")
  else:
    print("MMYY") l <= 12 and 1 <= l l <= 12 l 12 1 <= l 1 l print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if l <= 12 and 1 <= l:
    print("YYMM")
  else:
    print("NA") l <= 12 and 1 <= l l <= 12 l 12 1 <= l 1 l print("YYMM") print "YYMM" print("NA") print "NA" l = n % 100 n % 100 l r = n // 100 n // 100 r n = int(input()) int(input()) n
n = int(input())

r = n // 100
l = n % 100

if r <= 12 and 1 <= r:
  if l <= 12 and 1 <= l:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if l <= 12 and 1 <= l:
    print("YYMM")
  else:
    print("NA")