s = input()
ans = 'NA'
if 1 <= int(s[:2]) <= 12:
    ans = 'MMYY'
    if 1 <= int(s[2:]) <= 12:
        ans = 'AMBIGUOUS'
elif 1 <= int(s[2:]) <= 12:
    ans = 'YYMM'
print(ans) s = input() s input() input ans = 'NA' ans 'NA' if 1 <= int(s[:2]) <= 12:
    ans = 'MMYY'
    if 1 <= int(s[2:]) <= 12:
        ans = 'AMBIGUOUS'
elif 1 <= int(s[2:]) <= 12:
    ans = 'YYMM' 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 ans = 'MMYY' ans 'MMYY' if 1 <= int(s[2:]) <= 12:
        ans = 'AMBIGUOUS' 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) 1 int(s[2:]) int s[2:] s 2: 2 12 ans = 'AMBIGUOUS' ans 'AMBIGUOUS' elif 1 <= int(s[2:]) <= 12:
    ans = 'YYMM' 1 <= int(s[2:]) <= 12 1 <= int(s[2:]) 1 int(s[2:]) int s[2:] s 2: 2 12 ans = 'YYMM' ans 'YYMM' print(ans) print ans s = input() input() s ans = 'YYMM' 'YYMM' ans ans = 'AMBIGUOUS' 'AMBIGUOUS' ans ans = 'MMYY' 'MMYY' ans ans = 'NA' 'NA' ans
s = input()
ans = 'NA'
if 1 <= int(s[:2]) <= 12:
    ans = 'MMYY'
    if 1 <= int(s[2:]) <= 12:
        ans = 'AMBIGUOUS'
elif 1 <= int(s[2:]) <= 12:
    ans = 'YYMM'
print(ans)