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