def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA"


s = input()
yy = int(s[:2])
mm = int(s[2:])
print(solve(yy,mm)) def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA" solve if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA" 1<=yy<=12 1<=yy 1 yy 12 if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
     1 <= mm <=12 1 <= mm 1 mm 12 return 'AMBIGUOUS' 'AMBIGUOUS' return 'MMYY' 'MMYY' if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA" 1<= mm <= 12 1<= mm 1 mm 12 return 'YYMM' 'YYMM' return "NA" "NA" yy yy mm mm s = input() s input() input yy = int(s[:2]) yy int(s[:2]) int s[:2] s :2 2 mm = int(s[2:]) mm int(s[2:]) int s[2:] s 2: 2 print(solve(yy,mm)) print solve(yy,mm) solve yy mm yy = int(s[:2]) int(s[:2]) yy mm = int(s[2:]) int(s[2:]) mm def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA" def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA" solve s = input() input() s
def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA"


s = input()
yy = int(s[:2])
mm = int(s[2:])
print(solve(yy,mm))