S = input()
AS = S[:2]
BS = S[2:]
if 1<=int(AS)<=12 and 1<=int(BS)<=12:
    print('AMBIGUOUS')
elif 1<=int(AS)<=12:
    print('MMYY')
elif 1<=int(BS)<=12:
    print('YYMM')
else:
    print('NA') S = input() S input() input AS = S[:2] AS S[:2] S :2 2 BS = S[2:] BS S[2:] S 2: 2 if 1<=int(AS)<=12 and 1<=int(BS)<=12:
    print('AMBIGUOUS')
elif 1<=int(AS)<=12:
    print('MMYY')
elif 1<=int(BS)<=12:
    print('YYMM')
else:
    print('NA') 1<=int(AS)<=12 and 1<=int(BS)<=12 1<=int(AS)<=12 1<=int(AS) 1 int(AS) int AS 12 1<=int(BS)<=12 1<=int(BS) 1 int(BS) int BS 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1<=int(AS)<=12:
    print('MMYY') 1<=int(AS)<=12 1<=int(AS) 1 int(AS) int AS 12 print('MMYY') print 'MMYY' elif 1<=int(BS)<=12:
    print('YYMM') 1<=int(BS)<=12 1<=int(BS) 1 int(BS) int BS 12 print('YYMM') print 'YYMM' print('NA') print 'NA' BS = S[2:] S[2:] BS S = input() input() S AS = S[:2] S[:2] AS
S = input()
AS = S[:2]
BS = S[2:]
if 1<=int(AS)<=12 and 1<=int(BS)<=12:
    print('AMBIGUOUS')
elif 1<=int(AS)<=12:
    print('MMYY')
elif 1<=int(BS)<=12:
    print('YYMM')
else:
    print('NA')