a = input()
if int(a[:2]) < 13 and int(a[:2]) > 0:
    if int(a[2:4]) < 13 and int(a[2:4]) > 0: print('AMBIGUOUS')
    else: print('MMYY')
elif int(a[2:]) < 13 and int(a[2:]) > 0: print('YYMM')
else: print('NA') a = input() a input() input if int(a[:2]) < 13 and int(a[:2]) > 0:
    if int(a[2:4]) < 13 and int(a[2:4]) > 0: print('AMBIGUOUS')
    else: print('MMYY')
elif int(a[2:]) < 13 and int(a[2:]) > 0: print('YYMM')
else: print('NA') int(a[:2]) < 13 and int(a[:2]) > 0 int(a[:2]) < 13 int(a[:2]) int a[:2] a :2 2 13 int(a[:2]) > 0 int(a[:2]) int a[:2] a :2 2 0 if int(a[2:4]) < 13 and int(a[2:4]) > 0: print('AMBIGUOUS')
    else: print('MMYY') int(a[2:4]) < 13 and int(a[2:4]) > 0 int(a[2:4]) < 13 int(a[2:4]) int a[2:4] a 2:4 2 4 13 int(a[2:4]) > 0 int(a[2:4]) int a[2:4] a 2:4 2 4 0 elif int(a[2:]) < 13 and int(a[2:]) > 0: print('YYMM') int(a[2:]) < 13 and int(a[2:]) > 0 int(a[2:]) < 13 int(a[2:]) int a[2:] a 2: 2 13 int(a[2:]) > 0 int(a[2:]) int a[2:] a 2: 2 0 a = input() input() a
a = input()
if int(a[:2]) < 13 and int(a[:2]) > 0:
    if int(a[2:4]) < 13 and int(a[2:4]) > 0: print('AMBIGUOUS')
    else: print('MMYY')
elif int(a[2:]) < 13 and int(a[2:]) > 0: print('YYMM')
else: print('NA')