s = input()

a = (1 <= int(s[:2]) <= 12)
b = (1 <= int(s[2:]) <= 12)

if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA") s = input() s input() input a = (1 <= int(s[:2]) <= 12) a 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 b = (1 <= int(s[2:]) <= 12) b 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) 1 int(s[2:]) int s[2:] s 2: 2 12 if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA") a and b a b print("AMBIGUOUS") print "AMBIGUOUS" elif a:
    print("MMYY") a print("MMYY") print "MMYY" elif b:
    print("YYMM") b print("YYMM") print "YYMM" print("NA") print "NA" s = input() input() s b = (1 <= int(s[2:]) <= 12) 1 <= int(s[2:]) <= 12 b a = (1 <= int(s[:2]) <= 12) 1 <= int(s[:2]) <= 12 a
s = input()

a = (1 <= int(s[:2]) <= 12)
b = (1 <= int(s[2:]) <= 12)

if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA")