S=input()
Y=int(S[:2])
M=int(S[2:])
if Y==0 or Y>12:
    #Y!=MANTH
    if M==0 or M>12:
        print("NA")
    else:
        print("YYMM")
else:
    if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS") S=input() S input() input Y=int(S[:2]) Y int(S[:2]) int S[:2] S :2 2 M=int(S[2:]) M int(S[2:]) int S[2:] S 2: 2 if Y==0 or Y>12:
    #Y!=MANTH
    if M==0 or M>12:
        print("NA")
    else:
        print("YYMM")
else:
    if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS") Y==0 or Y>12 Y==0 Y 0 Y>12 Y 12 if M==0 or M>12:
        print("NA")
    else:
        print("YYMM") M==0 or M>12 M==0 M 0 M>12 M 12 print("NA") print "NA" print("YYMM") print "YYMM" if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS") M==0 or M>12 M==0 M 0 M>12 M 12 print("MMYY") print "MMYY" print("AMBIGUOUS") print "AMBIGUOUS" M=int(S[2:]) int(S[2:]) M S=input() input() S Y=int(S[:2]) int(S[:2]) Y
S=input()
Y=int(S[:2])
M=int(S[2:])
if Y==0 or Y>12:
    #Y!=MANTH
    if M==0 or M>12:
        print("NA")
    else:
        print("YYMM")
else:
    if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS")
