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