date=input()
if 1<=int(date[:2])<=12:
    if 1 <= int(date[2:]) <= 12:
        print("AMBIGUOUS")
        exit(0)
    else:
        print("MMYY")
        exit(0)
if int(date[2:])==0 or 13 <= int(date[2:]):
    print("NA")
    exit(0)
print("YYMM") date=input() date input() input if 1<=int(date[:2])<=12:
    if 1 <= int(date[2:]) <= 12:
        print("AMBIGUOUS")
        exit(0)
    else:
        print("MMYY")
        exit(0) 1<=int(date[:2])<=12 1<=int(date[:2]) 1 int(date[:2]) int date[:2] date :2 2 12 if 1 <= int(date[2:]) <= 12:
        print("AMBIGUOUS")
        exit(0)
    else:
        print("MMYY")
        exit(0) 1 <= int(date[2:]) <= 12 1 <= int(date[2:]) 1 int(date[2:]) int date[2:] date 2: 2 12 print("AMBIGUOUS") print "AMBIGUOUS" exit(0) exit 0 print("MMYY") print "MMYY" exit(0) exit 0 if int(date[2:])==0 or 13 <= int(date[2:]):
    print("NA")
    exit(0) int(date[2:])==0 or 13 <= int(date[2:]) int(date[2:])==0 int(date[2:]) int date[2:] date 2: 2 0 13 <= int(date[2:]) 13 int(date[2:]) int date[2:] date 2: 2 print("NA") print "NA" exit(0) exit 0 print("YYMM") print "YYMM" date=input() input() date
date=input()
if 1<=int(date[:2])<=12:
    if 1 <= int(date[2:]) <= 12:
        print("AMBIGUOUS")
        exit(0)
    else:
        print("MMYY")
        exit(0)
if int(date[2:])==0 or 13 <= int(date[2:]):
    print("NA")
    exit(0)
print("YYMM")