S = input()
months = [i for i in range(1, 13)]
left = int(S[:2])
right = int(S[2:])
if left in months and right in months:
    print('AMBIGUOUS')
elif left in months:
    print('MMYY')
elif right in months:
    print('YYMM')
else:
    print('NA') S = input() S input() input i for i in range(1, 13) for i in range(1, 13) i range(1, 13) range 1 13 for i in range(1, 13) i months = [i for i in range(1, 13)] months [i for i in range(1, 13)] left = int(S[:2]) left int(S[:2]) int S[:2] S :2 2 right = int(S[2:]) right int(S[2:]) int S[2:] S 2: 2 if left in months and right in months:
    print('AMBIGUOUS')
elif left in months:
    print('MMYY')
elif right in months:
    print('YYMM')
else:
    print('NA') left in months and right in months left in months left months right in months right months print('AMBIGUOUS') print 'AMBIGUOUS' elif left in months:
    print('MMYY') left in months left months print('MMYY') print 'MMYY' elif right in months:
    print('YYMM') right in months right months print('YYMM') print 'YYMM' print('NA') print 'NA' left = int(S[:2]) int(S[:2]) left S = input() input() S right = int(S[2:]) int(S[2:]) right months = [i for i in range(1, 13)] [i for i in range(1, 13)] months
S = input()
months = [i for i in range(1, 13)]
left = int(S[:2])
right = int(S[2:])
if left in months and right in months:
    print('AMBIGUOUS')
elif left in months:
    print('MMYY')
elif right in months:
    print('YYMM')
else:
    print('NA')