def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA')


if __name__ == '__main__':
    solve() def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA') solve s = input() s input() input front = int(s[:2]) front int(s[:2]) int s[:2] s :2 2 back = int(s[2:]) back int(s[2:]) int s[2:] s 2: 2 if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA') 1 <= front <= 12 and 1 <= back <= 12 1 <= front <= 12 1 <= front 1 front 12 1 <= back <= 12 1 <= back 1 back 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1 <= front <= 12:
        print('MMYY')
     1 <= front <= 12 1 <= front 1 front 12 print('MMYY') print 'MMYY' elif 1 <= back <= 12:
        print('YYMM')
     1 <= back <= 12 1 <= back 1 back 12 print('YYMM') print 'YYMM' print('NA') print 'NA' if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA') def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA') solve
def solve():
    s = input()
    front = int(s[:2])
    back = int(s[2:])
    if 1 <= front <= 12 and 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 1 <= front <= 12:
        print('MMYY')
    elif 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA')


if __name__ == '__main__':
    solve()
