def main():
    s = input()
    #print(s[:2], s[2:4])
    if (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA")

if __name__ == "__main__":
    main() def main():
    s = input()
    #print(s[:2], s[2:4])
    if (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA") main s = input() s input() input if (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA") (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) int(s[:2]) > 12 or int(s[:2]) == 0 int(s[:2]) > 12 int(s[:2]) int s[:2] s :2 2 12 int(s[:2]) == 0 int(s[:2]) int s[:2] s :2 2 0 int(s[2:4]) >= 1 and int(s[2:4]) <= 12 int(s[2:4]) >= 1 int(s[2:4]) int s[2:4] s 2:4 2 4 1 int(s[2:4]) <= 12 int(s[2:4]) int s[2:4] s 2:4 2 4 12 print("YYMM") print "YYMM" elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
     (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) int(s[2:4]) > 12 or int(s[2:4]) == 0 int(s[2:4]) > 12 int(s[2:4]) int s[2:4] s 2:4 2 4 12 int(s[2:4]) == 0 int(s[2:4]) int s[2:4] s 2:4 2 4 0 int(s[:2]) >=1 and int(s[:2]) <=12 int(s[:2]) >=1 int(s[:2]) int s[:2] s :2 2 1 int(s[:2]) <=12 int(s[:2]) int s[:2] s :2 2 12 print("MMYY") print "MMYY" elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
     (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) (int(s[:2]) >= 1 and int(s[:2])) <= 12 int(s[:2]) >= 1 and int(s[:2]) int(s[:2]) >= 1 int(s[:2]) int s[:2] s :2 2 1 int(s[:2]) int s[:2] s :2 2 12 int(s[2:4]) >=1 and int(s[2:4]) <= 12 int(s[2:4]) >=1 int(s[2:4]) int s[2:4] s 2:4 2 4 1 int(s[2:4]) <= 12 int(s[2:4]) int s[2:4] s 2:4 2 4 12 print("AMBIGUOUS") print "AMBIGUOUS" print("NA") print "NA" if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def main():
    s = input()
    #print(s[:2], s[2:4])
    if (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA") def main():
    s = input()
    #print(s[:2], s[2:4])
    if (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA") main
def main():
    s = input()
    #print(s[:2], s[2:4])
    if (int(s[:2]) > 12 or int(s[:2]) == 0)and (int(s[2:4]) >= 1 and int(s[2:4]) <= 12) :
        print("YYMM")
    elif (int(s[2:4]) > 12 or int(s[2:4]) == 0) and (int(s[:2]) >=1 and int(s[:2]) <=12) :
        print("MMYY")
    elif (int(s[:2]) >= 1 and int(s[:2])) <= 12 and (int(s[2:4]) >=1 and int(s[2:4]) <= 12) :
        print("AMBIGUOUS")
    else:
        print("NA")

if __name__ == "__main__":
    main()
