S = input()
YYMM = 0
MMYY = 0
start = S[0:2]
end = S[2:4]
tmp1 = int(start)
tmp2 = int(end)
if(tmp2 <= 12 and tmp2 != 0):
    YYMM = 1
if(tmp1 <= 12 and tmp1 != 0):
    MMYY = 1
if(YYMM == 1 and MMYY == 1):
    print("AMBIGUOUS")
elif(YYMM == 1):
    print("YYMM")
elif(MMYY == 1):
    print("MMYY")
else:
    print("NA") S = input() S input() input YYMM = 0 YYMM 0 MMYY = 0 MMYY 0 start = S[0:2] start S[0:2] S 0:2 0 2 end = S[2:4] end S[2:4] S 2:4 2 4 tmp1 = int(start) tmp1 int(start) int start tmp2 = int(end) tmp2 int(end) int end if(tmp2 <= 12 and tmp2 != 0):
    YYMM = 1 tmp2 <= 12 and tmp2 != 0 tmp2 <= 12 tmp2 12 tmp2 != 0 tmp2 0 YYMM = 1 YYMM 1 if(tmp1 <= 12 and tmp1 != 0):
    MMYY = 1 tmp1 <= 12 and tmp1 != 0 tmp1 <= 12 tmp1 12 tmp1 != 0 tmp1 0 MMYY = 1 MMYY 1 if(YYMM == 1 and MMYY == 1):
    print("AMBIGUOUS")
elif(YYMM == 1):
    print("YYMM")
elif(MMYY == 1):
    print("MMYY")
else:
    print("NA") YYMM == 1 and MMYY == 1 YYMM == 1 YYMM 1 MMYY == 1 MMYY 1 print("AMBIGUOUS") print "AMBIGUOUS" elif(YYMM == 1):
    print("YYMM") YYMM == 1 YYMM 1 print("YYMM") print "YYMM" elif(MMYY == 1):
    print("MMYY") MMYY == 1 MMYY 1 print("MMYY") print "MMYY" print("NA") print "NA" tmp2 = int(end) int(end) tmp2 start = S[0:2] S[0:2] start YYMM = 1 1 YYMM tmp1 = int(start) int(start) tmp1 MMYY = 1 1 MMYY YYMM = 0 0 YYMM S = input() input() S MMYY = 0 0 MMYY end = S[2:4] S[2:4] end
S = input()
YYMM = 0
MMYY = 0
start = S[0:2]
end = S[2:4]
tmp1 = int(start)
tmp2 = int(end)
if(tmp2 <= 12 and tmp2 != 0):
    YYMM = 1
if(tmp1 <= 12 and tmp1 != 0):
    MMYY = 1
if(YYMM == 1 and MMYY == 1):
    print("AMBIGUOUS")
elif(YYMM == 1):
    print("YYMM")
elif(MMYY == 1):
    print("MMYY")
else:
    print("NA")