s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA'

elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA'
print(out_print) s = input() s input() input n1 = s[0:2] n1 s[0:2] s 0:2 0 2 n2 = s[2:4] n2 s[2:4] s 2:4 2 4 if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA'

elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA' int(n1) > 12 and int(n2) > 12 int(n1) > 12 int(n1) int n1 12 int(n2) > 12 int(n2) int n2 12 out_print = 'NA' out_print 'NA' elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA' int(n1) <= 12 and int(n2) <= 12 int(n1) <= 12 int(n1) int n1 12 int(n2) <= 12 int(n2) int n2 12 out_print = 'AMBIGUOUS' out_print 'AMBIGUOUS' if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA' int(n1) == 0 and int(n2)!=0 int(n1) == 0 int(n1) int n1 0 int(n2)!=0 int(n2) int n2 0 out_print = 'YYMM' out_print 'YYMM' elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
     int(n1) != 0 and int(n2) == 0 int(n1) != 0 int(n1) int n1 0 int(n2) == 0 int(n2) int n2 0 out_print = 'MMYY' out_print 'MMYY' elif int(n1)==0 and int(n2)==0:
        out_print = 'NA' int(n1)==0 and int(n2)==0 int(n1)==0 int(n1) int n1 0 int(n2)==0 int(n2) int n2 0 out_print = 'NA' out_print 'NA' elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA' int(n1) <= 12 and int(n2) >12 int(n1) <= 12 int(n1) int n1 12 int(n2) >12 int(n2) int n2 12 out_print = 'MMYY' out_print 'MMYY' if int(n1) == 0:
        out_print = 'NA' int(n1) == 0 int(n1) int n1 0 out_print = 'NA' out_print 'NA' elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA' int(n1) > 12 and int(n2) <= 12 int(n1) > 12 int(n1) int n1 12 int(n2) <= 12 int(n2) int n2 12 out_print = 'YYMM' out_print 'YYMM' if int(n2) == 0:
        out_print = 'NA' int(n2) == 0 int(n2) int n2 0 out_print = 'NA' out_print 'NA' print(out_print) print out_print out_print = 'YYMM' 'YYMM' out_print out_print = 'YYMM' 'YYMM' out_print n1 = s[0:2] s[0:2] n1 n2 = s[2:4] s[2:4] n2 out_print = 'NA' 'NA' out_print out_print = 'MMYY' 'MMYY' out_print out_print = 'NA' 'NA' out_print out_print = 'NA' 'NA' out_print out_print = 'NA' 'NA' out_print s = input() input() s out_print = 'AMBIGUOUS' 'AMBIGUOUS' out_print out_print = 'MMYY' 'MMYY' out_print
s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA'

elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA'
print(out_print)
