S = eval(input())



A = int(S[0:2])

B = int(S[2:])



if A <= 12 and B <= 12 and A > 0 and B > 0:

    print("AMBIGUOUS")

elif (A > 12 or A == 0) and B <= 12 and B > 0:

    print("YYMM")

elif (B > 12 or B == 0) and A <= 12 and A > 0:

    print("MMYY")

else:

    print("NA")
# coding: utf-8

# Your code here!



S = eval(input())



A = int(S[0:2])

B = int(S[2:])

f1,f2 = False,False

if A > 0 and A <= 12:

    f1 = True

if B > 0 and B <= 12:

    f2 = True



if f1 and f2:

    print("AMBIGUOUS")

elif f1:

    print("MMYY")

elif f2:

    print("YYMM")

else:

    print("NA")
S = eval(input())
A = int(S[0:2])
B = int(S[2:])
if A <= 12 and B <= 12 and A > 0 and B > 0:
    print("AMBIGUOUS")
elif (A > 12 or A == 0) and B <= 12 and B > 0:
    print("YYMM")
elif (B > 12 or B == 0) and A <= 12 and A > 0:
    print("MMYY")
else:
    print("NA")

# coding: utf-8
# Your code here!
S = eval(input())
A = int(S[0:2])
B = int(S[2:])
f1, f2 = False, False
if A > 0 and A <= 12:
    f1 = True
if B > 0 and B <= 12:
    f2 = True
if f1 and f2:
    print("AMBIGUOUS")
elif f1:
    print("MMYY")
elif f2:
    print("YYMM")
else:
    print("NA")

+# coding: utf-8 +# Your code here! -if A <= 12 and B <= 12 and A > 0 and B > 0: +f1, f2 = False, False +if A > 0 and A <= 12: +    f1 = True +if B > 0 and B <= 12: +    f2 = True +if f1 and f2: -elif (A > 12 or A == 0) and B <= 12 and B > 0: +elif f1: +    print("MMYY") +elif f2: -elif (B > 12 or B == 0) and A <= 12 and A > 0: -    print("MMYY")