a=input()

b = int(a[:2])
c = int(a[2:])

if 0< b < 13:
    a_month_flag = 1
    a_year_flag = 1
elif b == 0:
    a_month_flag = 0
    a_year_flag = 0
else:
    a_month_flag = 0
    a_year_flag = 1

if 0< c < 13:
    b_month_flag = 1
    b_year_flag = 1
elif c == 0:
    b_month_flag = 0
    b_year_flag = 0
else:
    b_month_flag = 0
    b_year_flag = 1

if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA") a=input() a input() input b = int(a[:2]) b int(a[:2]) int a[:2] a :2 2 c = int(a[2:]) c int(a[2:]) int a[2:] a 2: 2 if 0< b < 13:
    a_month_flag = 1
    a_year_flag = 1
elif b == 0:
    a_month_flag = 0
    a_year_flag = 0
else:
    a_month_flag = 0
    a_year_flag = 1 0< b < 13 0< b 0 b 13 a_month_flag = 1 a_month_flag 1 a_year_flag = 1 a_year_flag 1 elif b == 0:
    a_month_flag = 0
    a_year_flag = 0 b == 0 b 0 a_month_flag = 0 a_month_flag 0 a_year_flag = 0 a_year_flag 0 a_month_flag = 0 a_month_flag 0 a_year_flag = 1 a_year_flag 1 if 0< c < 13:
    b_month_flag = 1
    b_year_flag = 1
elif c == 0:
    b_month_flag = 0
    b_year_flag = 0
else:
    b_month_flag = 0
    b_year_flag = 1 0< c < 13 0< c 0 c 13 b_month_flag = 1 b_month_flag 1 b_year_flag = 1 b_year_flag 1 elif c == 0:
    b_month_flag = 0
    b_year_flag = 0 c == 0 c 0 b_month_flag = 0 b_month_flag 0 b_year_flag = 0 b_year_flag 0 b_month_flag = 0 b_month_flag 0 b_year_flag = 1 b_year_flag 1 if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA") a_month_flag ==1 and b_month_flag==1 a_month_flag ==1 a_month_flag 1 b_month_flag==1 b_month_flag 1 print("AMBIGUOUS") print "AMBIGUOUS" elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY") a_month_flag == 1 and b_month_flag == 0 a_month_flag == 1 a_month_flag 1 b_month_flag == 0 b_month_flag 0 print("MMYY") print "MMYY" elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM") a_month_flag == 0 and b_month_flag ==1 a_month_flag == 0 a_month_flag 0 b_month_flag ==1 b_month_flag 1 print("YYMM") print "YYMM" print("NA") print "NA" a_month_flag = 0 0 a_month_flag b = int(a[:2]) int(a[:2]) b b_year_flag = 1 1 b_year_flag b_year_flag = 0 0 b_year_flag c = int(a[2:]) int(a[2:]) c a_month_flag = 1 1 a_month_flag a_year_flag = 0 0 a_year_flag b_month_flag = 1 1 b_month_flag a_year_flag = 1 1 a_year_flag b_month_flag = 0 0 b_month_flag a_year_flag = 1 1 a_year_flag a_month_flag = 0 0 a_month_flag a=input() input() a b_year_flag = 1 1 b_year_flag b_month_flag = 0 0 b_month_flag
a=input()

b = int(a[:2])
c = int(a[2:])

if 0< b < 13:
    a_month_flag = 1
    a_year_flag = 1
elif b == 0:
    a_month_flag = 0
    a_year_flag = 0
else:
    a_month_flag = 0
    a_year_flag = 1

if 0< c < 13:
    b_month_flag = 1
    b_year_flag = 1
elif c == 0:
    b_month_flag = 0
    b_year_flag = 0
else:
    b_month_flag = 0
    b_year_flag = 1

if a_month_flag ==1 and b_month_flag==1:
    print("AMBIGUOUS")
elif a_month_flag == 1 and b_month_flag == 0:
    print("MMYY")
elif a_month_flag == 0 and b_month_flag ==1:
    print("YYMM")
else:
    print("NA")