def YY(x):
    if 1<=x and x<=12:
        return True
    else:
        return False
S=input()
A=int(S[0:2])
B=int(S[2:4])
if YY(A) and YY(B):
    print("AMBIGUOUS")
elif YY(A):
    print("MMYY")
elif YY(B):
    print("YYMM")
else:
    print("NA") def YY(x):
    if 1<=x and x<=12:
        return True
    else:
        return False YY if 1<=x and x<=12:
        return True
    else:
        return False 1<=x and x<=12 1<=x 1 x x<=12 x 12 return True True return False False x x S=input() S input() input A=int(S[0:2]) A int(S[0:2]) int S[0:2] S 0:2 0 2 B=int(S[2:4]) B int(S[2:4]) int S[2:4] S 2:4 2 4 if YY(A) and YY(B):
    print("AMBIGUOUS")
elif YY(A):
    print("MMYY")
elif YY(B):
    print("YYMM")
else:
    print("NA") YY(A) and YY(B) YY(A) YY A YY(B) YY B print("AMBIGUOUS") print "AMBIGUOUS" elif YY(A):
    print("MMYY") YY(A) YY A print("MMYY") print "MMYY" elif YY(B):
    print("YYMM") YY(B) YY B print("YYMM") print "YYMM" print("NA") print "NA" def YY(x):
    if 1<=x and x<=12:
        return True
    else:
        return False def YY(x):
    if 1<=x and x<=12:
        return True
    else:
        return False YY S=input() input() S A=int(S[0:2]) int(S[0:2]) A B=int(S[2:4]) int(S[2:4]) B
def YY(x):
    if 1<=x and x<=12:
        return True
    else:
        return False
S=input()
A=int(S[0:2])
B=int(S[2:4])
if YY(A) and YY(B):
    print("AMBIGUOUS")
elif YY(A):
    print("MMYY")
elif YY(B):
    print("YYMM")
else:
    print("NA")
