# Vicfred
# https://atcoder.jp/contests/abc126/tasks/abc126_b
# implementation
s = int(input())

yy = s // 100
mm = s % 100

if 1 <= yy <= 12:
    if 1 <= mm <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= mm <= 12:
        print("YYMM")
    else:
        print("NA")
 s = int(input()) s int(input()) int input() input yy = s // 100 yy s // 100 s 100 mm = s % 100 mm s % 100 s 100 if 1 <= yy <= 12:
    if 1 <= mm <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= mm <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= yy <= 12 1 <= yy 1 yy 12 if 1 <= mm <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY") 1 <= mm <= 12 1 <= mm 1 mm 12 print("AMBIGUOUS") print "AMBIGUOUS" print("MMYY") print "MMYY" if 1 <= mm <= 12:
        print("YYMM")
    else:
        print("NA") 1 <= mm <= 12 1 <= mm 1 mm 12 print("YYMM") print "YYMM" print("NA") print "NA" mm = s % 100 s % 100 mm s = int(input()) int(input()) s yy = s // 100 s // 100 yy
# Vicfred
# https://atcoder.jp/contests/abc126/tasks/abc126_b
# implementation
s = int(input())

yy = s // 100
mm = s % 100

if 1 <= yy <= 12:
    if 1 <= mm <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= mm <= 12:
        print("YYMM")
    else:
        print("NA")

