import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    S = readline().strip()
    x = int(S[:2])
    y = int(S[2:])

    if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

    return


if __name__ == '__main__':
    main() import sys sys read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 def main():
    S = readline().strip()
    x = int(S[:2])
    y = int(S[2:])

    if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

    return main S = readline().strip() S readline().strip() ().strip () readline strip x = int(S[:2]) x int(S[:2]) int S[:2] S :2 2 y = int(S[2:]) y int(S[2:]) int S[2:] S 2: 2 if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

     1 <= x <= 12 1 <= x 1 x 12 if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
     1 <= y <= 12 1 <= y 1 y 12 print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

     1 <= y <= 12 1 <= y 1 y 12 print('YYMM') print 'YYMM' print('NA') print 'NA' return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main read = sys.stdin.read sys.stdin.read read def main():
    S = readline().strip()
    x = int(S[:2])
    y = int(S[2:])

    if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

    return def main():
    S = readline().strip()
    x = int(S[:2])
    y = int(S[2:])

    if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

    return main readline = sys.stdin.readline sys.stdin.readline readline readlines = sys.stdin.readlines sys.stdin.readlines readlines INF = 1 << 60 1 << 60 INF
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def main():
    S = readline().strip()
    x = int(S[:2])
    y = int(S[2:])

    if 1 <= x <= 12:
        if 1 <= y <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= y <= 12:
            print('YYMM')
        else:
            print('NA')

    return


if __name__ == '__main__':
    main()
