s = input()
F, T = False, True
ans = {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'}
print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12]) s = input() s input() input F, T = False, True F False T True ans = {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'} ans {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'} (F, F) (F, F) F F 'NA' (F, T) (F, T) F T 'YYMM' (T, F) (T, F) T F 'MMYY' (T, T) (T, T) T T 'AMBIGUOUS' print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12]) print ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12] ans 1 <= int(s[:2]) <= 12 1 <= int(s[:2]) 1 int(s[:2]) int s[:2] s :2 2 12 T = False, True True T ans = {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'} {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'} ans s = input() input() s F, T = False, True False F
s = input()
F, T = False, True
ans = {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'}
print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12])