s=input();a,b=map(int,(s[:2],s[2:]));print('AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA') s=input() s input() input a,b=map(int,(s[:2],s[2:])) a map(int,(s[:2],s[2:])) map int (s[:2],s[2:]) s[:2] s :2 2 s[2:] s 2: 2 b print('AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA') print 'AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA' 1<=a<=12 and 1<=b<=12 1<=a<=12 1<=a 1 a 12 1<=b<=12 1<=b 1 b 12 'AMBIGUOUS' 'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA' 1<=a<=12 and 0<=b<=99 1<=a<=12 1<=a 1 a 12 0<=b<=99 0<=b 0 b 99 'MMYY' 'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA' 0<=a<=99 and 1<=b<=12 0<=a<=99 0<=a 0 a 99 1<=b<=12 1<=b 1 b 12 'YYMM' 'NA' a,b=map(int,(s[:2],s[2:])) map(int,(s[:2],s[2:])) a s=input() input() s b=map(int,(s[:2],s[2:])) map(int,(s[:2],s[2:])) b
s=input();a,b=map(int,(s[:2],s[2:]));print('AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA')