# abc126_b.py
def mm(n):
    if 0 < n and n < 13:
        return True
    else:
        return False

S = input()

head = int(S[:2])
tail = int(S[2:])
head_mm = mm(head)
tail_mm = mm(tail)
if head_mm and tail_mm:
    print("AMBIGUOUS")
elif head_mm:
    print("MMYY")
elif tail_mm:
    print("YYMM")
else:
    print("NA") def mm(n):
    if 0 < n and n < 13:
        return True
    else:
        return False mm if 0 < n and n < 13:
        return True
    else:
        return False 0 < n and n < 13 0 < n 0 n n < 13 n 13 return True True return False False n n S = input() S input() input head = int(S[:2]) head int(S[:2]) int S[:2] S :2 2 tail = int(S[2:]) tail int(S[2:]) int S[2:] S 2: 2 head_mm = mm(head) head_mm mm(head) mm head tail_mm = mm(tail) tail_mm mm(tail) mm tail if head_mm and tail_mm:
    print("AMBIGUOUS")
elif head_mm:
    print("MMYY")
elif tail_mm:
    print("YYMM")
else:
    print("NA") head_mm and tail_mm head_mm tail_mm print("AMBIGUOUS") print "AMBIGUOUS" elif head_mm:
    print("MMYY") head_mm print("MMYY") print "MMYY" elif tail_mm:
    print("YYMM") tail_mm print("YYMM") print "YYMM" print("NA") print "NA" head_mm = mm(head) mm(head) head_mm S = input() input() S tail_mm = mm(tail) mm(tail) tail_mm tail = int(S[2:]) int(S[2:]) tail def mm(n):
    if 0 < n and n < 13:
        return True
    else:
        return False def mm(n):
    if 0 < n and n < 13:
        return True
    else:
        return False mm head = int(S[:2]) int(S[:2]) head
# abc126_b.py
def mm(n):
    if 0 < n and n < 13:
        return True
    else:
        return False

S = input()

head = int(S[:2])
tail = int(S[2:])
head_mm = mm(head)
tail_mm = mm(tail)
if head_mm and tail_mm:
    print("AMBIGUOUS")
elif head_mm:
    print("MMYY")
elif tail_mm:
    print("YYMM")
else:
    print("NA")