s = input()
s1, s2 = int(s[:2]), int(s[2:])
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
print(ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)]) s = input() s input() input s1, s2 = int(s[:2]), int(s[2:]) s1 int(s[:2]) int s[:2] s :2 2 s2 int(s[2:]) int s[2:] s 2: 2 ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'] ans ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'] 'NA' 'YYMM' 'MMYY' 'AMBIGUOUS' print(ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)]) print ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)] ans ((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12) (1 <= s1 <= 12) << 1 1 <= s1 <= 12 1 <= s1 1 s1 12 1 1 <= s2 <= 12 1 <= s2 1 s2 12 s = input() input() s ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'] ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'] ans s2 = int(s[:2]), int(s[2:]) int(s[2:]) s2 s1, s2 = int(s[:2]), int(s[2:]) int(s[:2]) s1
s = input()
s1, s2 = int(s[:2]), int(s[2:])
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
print(ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)])