s = int(input())
a = s % 100
b = ((s-a) / 100)
if a <= 12 and b <= 12 and a != 0 and b != 0:
  print("AMBIGUOUS")
elif b <= 12 and b != 0:
  print("MMYY")
elif a <= 12 and a != 0:
  print("YYMM")
else:
  print("NA") s = int(input()) s int(input()) int input() input a = s % 100 a s % 100 s 100 b = ((s-a) / 100) b (s-a) / 100 s-a s a 100 if a <= 12 and b <= 12 and a != 0 and b != 0:
  print("AMBIGUOUS")
elif b <= 12 and b != 0:
  print("MMYY")
elif a <= 12 and a != 0:
  print("YYMM")
else:
  print("NA") a <= 12 and b <= 12 and a != 0 and b != 0 a <= 12 and b <= 12 and a != 0 a <= 12 and b <= 12 a <= 12 a 12 b <= 12 b 12 a != 0 a 0 b != 0 b 0 print("AMBIGUOUS") print "AMBIGUOUS" elif b <= 12 and b != 0:
  print("MMYY") b <= 12 and b != 0 b <= 12 b 12 b != 0 b 0 print("MMYY") print "MMYY" elif a <= 12 and a != 0:
  print("YYMM") a <= 12 and a != 0 a <= 12 a 12 a != 0 a 0 print("YYMM") print "YYMM" print("NA") print "NA" a = s % 100 s % 100 a s = int(input()) int(input()) s b = ((s-a) / 100) (s-a) / 100 b
s = int(input())
a = s % 100
b = ((s-a) / 100)
if a <= 12 and b <= 12 and a != 0 and b != 0:
  print("AMBIGUOUS")
elif b <= 12 and b != 0:
  print("MMYY")
elif a <= 12 and a != 0:
  print("YYMM")
else:
  print("NA")