s = eval(input())

s1 = int(s[:2])

s2 = int(s[2:])

m = list(range(1,13))

if s1 in m and s2 in m:

    print('AMBIGUOUS')

elif s1 in m:

    print('MMYY')

elif s2 in m:

    print('YYMM')

else:

    print('NA')
s = eval(input())

s1 = int(s[:2])

s2 = int(s[2:])

if 1<=s1<=12 and 1<=s2<=12:

    print('AMBIGUOUS')

elif 1<=s1<=12:

    print('MMYY')

elif 1<=s2<=12:

    print('YYMM')

else:

    print('NA')
s = eval(input())
s1 = int(s[:2])
s2 = int(s[2:])
m = list(range(1, 13))
if s1 in m and s2 in m:
    print("AMBIGUOUS")
elif s1 in m:
    print("MMYY")
elif s2 in m:
    print("YYMM")
else:
    print("NA")

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

-m = list(range(1, 13)) -if s1 in m and s2 in m: +if 1 <= s1 <= 12 and 1 <= s2 <= 12: -elif s1 in m: +elif 1 <= s1 <= 12: -elif s2 in m: +elif 1 <= s2 <= 12: