#!/usr/bin/env python3
s = input()
a=0<int(s[:2])<13
b=0<int(s[-2:])<13
if a and b:
    print('AMBIGUOUS')
elif b:
    print('YYMM')
elif a:
    print('MMYY')
else:
    print('NA') s = input() s input() input a=0<int(s[:2])<13 a 0<int(s[:2])<13 0<int(s[:2]) 0 int(s[:2]) int s[:2] s :2 2 13 b=0<int(s[-2:])<13 b 0<int(s[-2:])<13 0<int(s[-2:]) 0 int(s[-2:]) int s[-2:] s -2: -2 13 if a and b:
    print('AMBIGUOUS')
elif b:
    print('YYMM')
elif a:
    print('MMYY')
else:
    print('NA') a and b a b print('AMBIGUOUS') print 'AMBIGUOUS' elif b:
    print('YYMM') b print('YYMM') print 'YYMM' elif a:
    print('MMYY') a print('MMYY') print 'MMYY' print('NA') print 'NA' a=0<int(s[:2])<13 0<int(s[:2])<13 a b=0<int(s[-2:])<13 0<int(s[-2:])<13 b s = input() input() s
#!/usr/bin/env python3
s = input()
a=0<int(s[:2])<13
b=0<int(s[-2:])<13
if a and b:
    print('AMBIGUOUS')
elif b:
    print('YYMM')
elif a:
    print('MMYY')
else:
    print('NA')
