x = int(input())
a = x // 100
b = x % 100

a_is_month = 0 < a & a <= 12
b_is_month = 0 < b & b <= 12

if a_is_month:
    if b_is_month:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b_is_month:
        print("YYMM")
    else:
        print("NA")
 x = int(input()) x int(input()) int input() input a = x // 100 a x // 100 x 100 b = x % 100 b x % 100 x 100 a_is_month = 0 < a & a <= 12 a_is_month 0 < a & a <= 12 0 < a & a 0 a & a a a 12 b_is_month = 0 < b & b <= 12 b_is_month 0 < b & b <= 12 0 < b & b 0 b & b b b 12 if a_is_month:
    if b_is_month:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b_is_month:
        print("YYMM")
    else:
        print("NA") a_is_month if b_is_month:
        print("AMBIGUOUS")
    else:
        print("MMYY") b_is_month print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if b_is_month:
        print("YYMM")
    else:
        print("NA") b_is_month print("YYMM") print "YYMM" print("NA") print "NA" x = int(input()) int(input()) x b_is_month = 0 < b & b <= 12 0 < b & b <= 12 b_is_month b = x % 100 x % 100 b a_is_month = 0 < a & a <= 12 0 < a & a <= 12 a_is_month a = x // 100 x // 100 a
x = int(input())
a = x // 100
b = x % 100

a_is_month = 0 < a & a <= 12
b_is_month = 0 < b & b <= 12

if a_is_month:
    if b_is_month:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b_is_month:
        print("YYMM")
    else:
        print("NA")

