N = int(input())
a = N // 100
b = N % 100
if 1 <= a <= 12:
  if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA") N = int(input()) N int(input()) int input() input a = N // 100 a N // 100 N 100 b = N % 100 b N % 100 N 100 if 1 <= a <= 12:
  if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA") 1 <= a <= 12 1 <= a 1 a 12 if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY") 1 <= b <= 12 1 <= b 1 b 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA") 1 <= b <= 12 1 <= b 1 b 12 print("YYMM") print "YYMM" print("NA") print "NA" a = N // 100 N // 100 a b = N % 100 N % 100 b N = int(input()) int(input()) N
N = int(input())
a = N // 100
b = N % 100
if 1 <= a <= 12:
  if 1 <= b <= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1 <= b <= 12:
    print("YYMM")
  else:
    print("NA")