#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

s = input()

temp1 = int(s[0:2])
temp2 = int(s[2:4])

if temp1 >= 1 and temp1 <= 12:
    if (temp2 < 1 or temp2 > 12):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if (temp2 >= 1 and temp2 <= 12):
        print("YYMM")
    else:
        print("NA") s = input() s input() input temp1 = int(s[0:2]) temp1 int(s[0:2]) int s[0:2] s 0:2 0 2 temp2 = int(s[2:4]) temp2 int(s[2:4]) int s[2:4] s 2:4 2 4 if temp1 >= 1 and temp1 <= 12:
    if (temp2 < 1 or temp2 > 12):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if (temp2 >= 1 and temp2 <= 12):
        print("YYMM")
    else:
        print("NA") temp1 >= 1 and temp1 <= 12 temp1 >= 1 temp1 1 temp1 <= 12 temp1 12 if (temp2 < 1 or temp2 > 12):
        print("MMYY")
    else:
        print("AMBIGUOUS") temp2 < 1 or temp2 > 12 temp2 < 1 temp2 1 temp2 > 12 temp2 12 print("MMYY") print "MMYY" print("AMBIGUOUS") print "AMBIGUOUS" if (temp2 >= 1 and temp2 <= 12):
        print("YYMM")
    else:
        print("NA") temp2 >= 1 and temp2 <= 12 temp2 >= 1 temp2 1 temp2 <= 12 temp2 12 print("YYMM") print "YYMM" print("NA") print "NA" temp1 = int(s[0:2]) int(s[0:2]) temp1 s = input() input() s temp2 = int(s[2:4]) int(s[2:4]) temp2
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

s = input()

temp1 = int(s[0:2])
temp2 = int(s[2:4])

if temp1 >= 1 and temp1 <= 12:
    if (temp2 < 1 or temp2 > 12):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if (temp2 >= 1 and temp2 <= 12):
        print("YYMM")
    else:
        print("NA")
