def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return
main() def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return main inp=input() inp input() input ch1=int(inp[0:2]) ch1 int(inp[0:2]) int inp[0:2] inp 0:2 0 2 ch2=int(inp[2:]) ch2 int(inp[2:]) int inp[2:] inp 2: 2 if inp[0]==0:
        ch1=int(inp[1])
     inp[0]==0 inp[0] inp 0 0 ch1=int(inp[1]) ch1 int(inp[1]) int inp[1] inp 1 if inp[2]==0:
        ch2=int(inp[-1])
     inp[2]==0 inp[2] inp 2 0 ch2=int(inp[-1]) ch2 int(inp[-1]) int inp[-1] inp -1 if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
     ch1<=12 and ch1>=1 ch1<=12 ch1 12 ch1>=1 ch1 1 if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
     ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1 ch2<=12 and ch2>=1 and ch2<=12 ch2<=12 and ch2>=1 ch2<=12 ch2 12 ch2>=1 ch2 1 ch2<=12 ch2 12 ch2>=1 ch2 1 print("AMBIGUOUS") print "AMBIGUOUS" return elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
     ch2<=12 or ch2>=1 ch2<=12 ch2 12 ch2>=1 ch2 1 print("MMYY") print "MMYY" return if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return ch1>12 or ch1<1 ch1>12 ch1 12 ch1<1 ch1 1 if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return ch2<=12 and ch2>=1 ch2<=12 ch2 12 ch2>=1 ch2 1 print("YYMM") print "YYMM" return print("NA") print "NA" return main() main def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return main
def main():
    inp=input()
    ch1=int(inp[0:2])
    ch2=int(inp[2:])
    if inp[0]==0:
        ch1=int(inp[1])
    if inp[2]==0:
        ch2=int(inp[-1])
    if ch1<=12 and ch1>=1:
        if ch2<=12 and ch2>=1 and ch2<=12 and ch2>=1:
            print("AMBIGUOUS")
            return
        elif ch2<=12 or ch2>=1:
            print("MMYY")
            return
    if ch1>12 or ch1<1:
        if ch2<=12 and ch2>=1:
            print("YYMM")
            return
        else:
            print("NA")
            return
main()