def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main() def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA") main S = input().rstrip() S input().rstrip() ().rstrip () input rstrip v1 = int(S[:2]) v1 int(S[:2]) int S[:2] S :2 2 v2 = int(S[2:]) v2 int(S[2:]) int S[2:] S 2: 2 if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= v1 <= 12 and 1 <= v2 <= 12 1 <= v1 <= 12 1 <= v1 1 v1 12 1 <= v2 <= 12 1 <= v2 1 v2 12 print("AMBIGUOUS") print "AMBIGUOUS" elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
     1 <= v1 <= 12 and (v2 >= 13 or v2 == 0) 1 <= v1 <= 12 1 <= v1 1 v1 12 v2 >= 13 or v2 == 0 v2 >= 13 v2 13 v2 == 0 v2 0 print("MMYY") print "MMYY" elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
     (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12 v1 >= 13 or v1 == 0 v1 >= 13 v1 13 v1 == 0 v1 0 1 <= v2 <= 12 1 <= v2 1 v2 12 print("YYMM") print "YYMM" print("NA") print "NA" if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA") def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA") main
def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()
