# -*- coding: utf-8 -*-

def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans)


if __name__ == "__main__":
    main() def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans) main S = input() S input() input listS = [int(S[:2]), int(S[2:])] listS [int(S[:2]), int(S[2:])] int(S[:2]) int S[:2] S :2 2 int(S[2:]) int S[2:] S 2: 2 if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

     1 <= listS[0] <= 12 and 1 <= listS[1] <= 12 1 <= listS[0] <= 12 1 <= listS[0] 1 listS[0] listS 0 12 1 <= listS[1] <= 12 1 <= listS[1] 1 listS[1] listS 1 12 ans = 'AMBIGUOUS' ans 'AMBIGUOUS' elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

     1 <= listS[0] <= 12 1 <= listS[0] 1 listS[0] listS 0 12 ans = 'MMYY' ans 'MMYY' elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

     1 <= listS[1] <= 12 1 <= listS[1] 1 listS[1] listS 1 12 ans = 'YYMM' ans 'YYMM' ans = 'NA' ans 'NA' print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans) def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans) main
# -*- coding: utf-8 -*-

def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans)


if __name__ == "__main__":
    main()