S=input()
months=['01','02','03','04','05','06','07','08','09','10','11','12']

if S[0:2] in months and S[2:4] in months:
    print('AMBIGUOUS')
elif S[0:2] in months:
    print('MMYY')
elif S[2:4] in months:
    print('YYMM')
else:
    print('NA') S=input() S input() input months=['01','02','03','04','05','06','07','08','09','10','11','12'] months ['01','02','03','04','05','06','07','08','09','10','11','12'] '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' if S[0:2] in months and S[2:4] in months:
    print('AMBIGUOUS')
elif S[0:2] in months:
    print('MMYY')
elif S[2:4] in months:
    print('YYMM')
else:
    print('NA') S[0:2] in months and S[2:4] in months S[0:2] in months S[0:2] S 0:2 0 2 months S[2:4] in months S[2:4] S 2:4 2 4 months print('AMBIGUOUS') print 'AMBIGUOUS' elif S[0:2] in months:
    print('MMYY') S[0:2] in months S[0:2] S 0:2 0 2 months print('MMYY') print 'MMYY' elif S[2:4] in months:
    print('YYMM') S[2:4] in months S[2:4] S 2:4 2 4 months print('YYMM') print 'YYMM' print('NA') print 'NA' months=['01','02','03','04','05','06','07','08','09','10','11','12'] ['01','02','03','04','05','06','07','08','09','10','11','12'] months S=input() input() S
S=input()
months=['01','02','03','04','05','06','07','08','09','10','11','12']

if S[0:2] in months and S[2:4] in months:
    print('AMBIGUOUS')
elif S[0:2] in months:
    print('MMYY')
elif S[2:4] in months:
    print('YYMM')
else:
    print('NA')