s = input()
x = int(s[:2])
y = int(s[2:])
if 1 <= x <= 12 and 1 <= y <= 12:
    a = "AMBIGUOUS"
elif 1 <= x <= 12:
    a = "MMYY"
elif 1 <= y <= 12:
    a = "YYMM"
else:
    a = "NA"
print(a) 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:
    a = "AMBIGUOUS"
elif 1 <= x <= 12:
    a = "MMYY"
elif 1 <= y <= 12:
    a = "YYMM"
else:
    a = "NA" 1 <= x <= 12 and 1 <= y <= 12 1 <= x <= 12 1 <= x 1 x 12 1 <= y <= 12 1 <= y 1 y 12 a = "AMBIGUOUS" a "AMBIGUOUS" elif 1 <= x <= 12:
    a = "MMYY" 1 <= x <= 12 1 <= x 1 x 12 a = "MMYY" a "MMYY" elif 1 <= y <= 12:
    a = "YYMM" 1 <= y <= 12 1 <= y 1 y 12 a = "YYMM" a "YYMM" a = "NA" a "NA" print(a) print a a = "AMBIGUOUS" "AMBIGUOUS" a y = int(s[2:]) int(s[2:]) y s = input() input() s a = "MMYY" "MMYY" a a = "NA" "NA" a a = "YYMM" "YYMM" a x = int(s[:2]) int(s[:2]) x
s = input()
x = int(s[:2])
y = int(s[2:])
if 1 <= x <= 12 and 1 <= y <= 12:
    a = "AMBIGUOUS"
elif 1 <= x <= 12:
    a = "MMYY"
elif 1 <= y <= 12:
    a = "YYMM"
else:
    a = "NA"
print(a)