import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
    
if __name__ == '__main__':
    main() import sys sys input = lambda: sys.stdin.readline().rstrip() input lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
     main 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 month = [i for i in range(1, 13)] month [i for i in range(1, 13)] if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
     int(s[:2]) not in month and int(s[2:]) in month int(s[:2]) not in month int(s[:2]) int s[:2] s :2 2 month int(s[2:]) in month int(s[2:]) int s[2:] s 2: 2 month print('YYMM') print 'YYMM' elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
     int(s[:2]) in month and int(s[2:]) not in month int(s[:2]) in month int(s[:2]) int s[:2] s :2 2 month int(s[2:]) not in month int(s[2:]) int s[2:] s 2: 2 month print('MMYY') print 'MMYY' elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
     int(s[:2]) in month and int(s[2:]) in month int(s[:2]) in month int(s[:2]) int s[:2] s :2 2 month int(s[2:]) in month int(s[2:]) int s[2:] s 2: 2 month print('AMBIGUOUS') print 'AMBIGUOUS' print('NA') print 'NA' if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
     def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
     main input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
    
if __name__ == '__main__':
    main()