s = input()
a = s[:2]
b = s[2:]
b1 = 0
a1 = 0

if b[0] == '0': b1 = int(b[1])
else: b1 = int(b)
if a[0] == '0': a1 = int(a[1])
else: a1 = int(a)

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

if b[0] == '0': b1 = int(b[1])
else: b1 = int(b)
if a[0] == '0': a1 = int(a[1])
else: a1 = int(a)

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