import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    S = ins()
    a = int(S[:2])
    b = int(S[2:])
    am = 0 < a < 13
    bm = 0 < b < 13
    if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA"


print(solve()) import sys sys sys.setrecursionlimit(10 ** 8) sys.setrecursionlimit sys setrecursionlimit 10 ** 8 10 8 ini = lambda: int(sys.stdin.readline()) ini lambda: int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x inl = lambda: [int(x) for x in sys.stdin.readline().split()] inl lambda: [int(x) for x in sys.stdin.readline().split()] [int(x) for x in sys.stdin.readline().split()] ins = lambda: sys.stdin.readline().rstrip() ins lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) debug lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) print "\033[33m" *a a "\033[0m" **dict(file=sys.stderr, **kw) dict(file=sys.stderr, **kw) dict file=sys.stderr file sys.stderr sys stderr **kw kw *a **kw def solve():
    S = ins()
    a = int(S[:2])
    b = int(S[2:])
    am = 0 < a < 13
    bm = 0 < b < 13
    if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA" solve S = ins() S ins() ins a = int(S[:2]) a int(S[:2]) int S[:2] S :2 2 b = int(S[2:]) b int(S[2:]) int S[2:] S 2: 2 am = 0 < a < 13 am 0 < a < 13 0 < a 0 a 13 bm = 0 < b < 13 bm 0 < b < 13 0 < b 0 b 13 if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA" am and bm am bm return "AMBIGUOUS" "AMBIGUOUS" elif am:
        return "MMYY"
     am return "MMYY" "MMYY" elif bm:
        return "YYMM"
     bm return "YYMM" "YYMM" return "NA" "NA" print(solve()) print solve() solve ins = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() ins ini = lambda: int(sys.stdin.readline()) lambda: int(sys.stdin.readline()) ini debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw)) debug inl = lambda: [int(x) for x in sys.stdin.readline().split()] lambda: [int(x) for x in sys.stdin.readline().split()] inl def solve():
    S = ins()
    a = int(S[:2])
    b = int(S[2:])
    am = 0 < a < 13
    bm = 0 < b < 13
    if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA" def solve():
    S = ins()
    a = int(S[:2])
    b = int(S[2:])
    am = 0 < a < 13
    bm = 0 < b < 13
    if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA" solve
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    S = ins()
    a = int(S[:2])
    b = int(S[2:])
    am = 0 < a < 13
    bm = 0 < b < 13
    if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA"


print(solve())
