S = input()

A = int(S[:2])
B = int(S[2:])

if  1 <= A and A <= 12:
    if  1 <= B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if  1 <= B and B <= 12:
        print("YYMM")
    else:
        print("NA") S = input() S input() input A = int(S[:2]) A int(S[:2]) int S[:2] S :2 2 B = int(S[2:]) B int(S[2:]) int S[2:] S 2: 2 if  1 <= A and A <= 12:
    if  1 <= B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if  1 <= B and B <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= A and A <= 12 1 <= A 1 A A <= 12 A 12 if  1 <= B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") 1 <= B and B <= 12 1 <= B 1 B B <= 12 B 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if  1 <= B and B <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= B and B <= 12 1 <= B 1 B B <= 12 B 12 print("YYMM") print "YYMM" print("NA") print "NA" A = int(S[:2]) int(S[:2]) A B = int(S[2:]) int(S[2:]) B S = input() input() S
S = input()

A = int(S[:2])
B = int(S[2:])

if  1 <= A and A <= 12:
    if  1 <= B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if  1 <= B and B <= 12:
        print("YYMM")
    else:
        print("NA")
