s = input()
a = 0
b = 0

if s[2] == '0': b = int(s[3])
else: b = int(s[2:])
if s[0] == '0': a = int(s[1])
else: a = int(s[:2])

if (b>=1 and b<=12) and (a>=1 and a<=12): print("AMBIGUOUS")
elif b>=1 and b<=12: print("YYMM")
elif a>=1 and a<=12: print("MMYY")
else: print("NA")  s = input() s input() input a = 0 a 0 b = 0 b 0 if s[2] == '0': b = int(s[3])
else: b = int(s[2:]) s[2] == '0' s[2] s 2 '0' if s[0] == '0': a = int(s[1])
else: a = int(s[:2]) s[0] == '0' s[0] s 0 '0' if (b>=1 and b<=12) and (a>=1 and a<=12): print("AMBIGUOUS")
elif b>=1 and b<=12: print("YYMM")
elif a>=1 and a<=12: print("MMYY")
else: print("NA")  (b>=1 and b<=12) and (a>=1 and a<=12) b>=1 and b<=12 b>=1 b 1 b<=12 b 12 a>=1 and a<=12 a>=1 a 1 a<=12 a 12 elif b>=1 and b<=12: print("YYMM") b>=1 and b<=12 b>=1 b 1 b<=12 b 12 elif a>=1 and a<=12: print("MMYY") a>=1 and a<=12 a>=1 a 1 a<=12 a 12 a = 0 0 a s = input() input() s b = 0 0 b
s = input()
a = 0
b = 0

if s[2] == '0': b = int(s[3])
else: b = int(s[2:])
if s[0] == '0': a = int(s[1])
else: a = int(s[:2])

if (b>=1 and b<=12) and (a>=1 and a<=12): print("AMBIGUOUS")
elif b>=1 and b<=12: print("YYMM")
elif a>=1 and a<=12: print("MMYY")
else: print("NA") 