s = input()

x = int(s[:2])
y = int(s[2:])

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

x = int(s[:2])
y = int(s[2:])

if 1 <= x <= 12 and 1 <= y <= 12:
    print("AMBIGUOUS")
elif 1 <= x <= 12:
    print("MMYY")
elif 1 <= y <= 12:
    print("YYMM")
else:
    print('NA')