# 月のフォーマットによる場合分け。
s = list(input())
# 前二桁
s1 = int("".join(s[:2]))
# 後二桁
s2 = int("".join(s[2:]))

# 前二桁と後二桁に月の可能性がある。
if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA') s = list(input()) s list(input()) list input() input s1 = int("".join(s[:2])) s1 int("".join(s[:2])) int "".join(s[:2]) "".join "" join s[:2] s :2 2 s2 = int("".join(s[2:])) s2 int("".join(s[2:])) int "".join(s[2:]) "".join "" join s[2:] s 2: 2 if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA') 1 <= s1 <= 12 and 1 <= s2 <= 12 1 <= s1 <= 12 1 <= s1 1 s1 12 1 <= s2 <= 12 1 <= s2 1 s2 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1 <= s1 <= 12:
    print('MMYY') 1 <= s1 <= 12 1 <= s1 1 s1 12 print('MMYY') print 'MMYY' elif 1 <= s2 <= 12:
    print('YYMM') 1 <= s2 <= 12 1 <= s2 1 s2 12 print('YYMM') print 'YYMM' print('NA') print 'NA' s = list(input()) list(input()) s s1 = int("".join(s[:2])) int("".join(s[:2])) s1 s2 = int("".join(s[2:])) int("".join(s[2:])) s2
# 月のフォーマットによる場合分け。
s = list(input())
# 前二桁
s1 = int("".join(s[:2]))
# 後二桁
s2 = int("".join(s[2:]))

# 前二桁と後二桁に月の可能性がある。
if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA')
