s=input();r=''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]);print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY']) 'MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:]))) for i in list(map(int,(s[:2],s[2:]))) i list(map(int,(s[:2],s[2:]))) list map(int,(s[:2],s[2:])) map int (s[:2],s[2:]) s[:2] s :2 2 s[2:] s 2: 2 for i in list(map(int,(s[:2],s[2:]))) 'MM'if 1<=i<=12 else'YY' 1<=i<=12 1<=i 1 i 12 'MM' 'YY' s=input() s input() input r=''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]) r ''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]) ''.join '' join ['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))] print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY']) print r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY'] r!='MMMM'and r!='YYYY' r!='MMMM' r 'MMMM' r!='YYYY' r 'YYYY' r ['AMBIGUOUS','NA'][r=='YYYY'] ['AMBIGUOUS','NA'] 'AMBIGUOUS' 'NA' r=='YYYY' r 'YYYY' s=input() input() s r=''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]) ''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]) r
s=input();r=''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]);print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY'])