s = input()
mae = int(s[:2])
usiro = int(s[2:])

ym = 0
my = 0

if (1 <= usiro <= 12): ym = 1
if (1 <= mae <= 12): my = 1

if (ym and my): print("AMBIGUOUS")
elif (ym): print("YYMM")
elif (my): print("MMYY")
else: print("NA")
 s = input() s input() input mae = int(s[:2]) mae int(s[:2]) int s[:2] s :2 2 usiro = int(s[2:]) usiro int(s[2:]) int s[2:] s 2: 2 ym = 0 ym 0 my = 0 my 0 if (1 <= usiro <= 12): ym = 1 1 <= usiro <= 12 1 <= usiro 1 usiro 12 if (1 <= mae <= 12): my = 1 1 <= mae <= 12 1 <= mae 1 mae 12 if (ym and my): print("AMBIGUOUS")
elif (ym): print("YYMM")
elif (my): print("MMYY")
else: print("NA") ym and my ym my elif (ym): print("YYMM") ym elif (my): print("MMYY") my usiro = int(s[2:]) int(s[2:]) usiro ym = 0 0 ym my = 0 0 my s = input() input() s mae = int(s[:2]) int(s[:2]) mae
s = input()
mae = int(s[:2])
usiro = int(s[2:])

ym = 0
my = 0

if (1 <= usiro <= 12): ym = 1
if (1 <= mae <= 12): my = 1

if (ym and my): print("AMBIGUOUS")
elif (ym): print("YYMM")
elif (my): print("MMYY")
else: print("NA")

