import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def is_yymm(f, l):
    if 1 <= l <= 12:
        return True
    return False


def is_mmyy(f, l):
    if 1 <= f <= 12:
        return True
    return False


s = S()
f = int(s[:2])
l = int(s[2:])

if is_yymm(f, l) and is_mmyy(f, l):
    print('AMBIGUOUS')

elif is_yymm(f, l) and not(is_mmyy(f, l)):
    print('YYMM')

elif not(is_yymm(f, l)) and is_mmyy(f, l):
    print('MMYY')

else:
    print('NA') import sys sys def input(): return sys.stdin.readline().strip() input def I(): return int(input()) I def LI(): return list(map(int, input().split())) LI I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I def IR(n): return [I() for i in range(n)] IR n n LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI def LIR(n): return [LI() for i in range(n)] LIR n n S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S def SR(n): return [S() for i in range(n)] SR n n def S(): return input() S def LS(): return input().split() LS INF = float('inf') INF float('inf') float 'inf' def is_yymm(f, l):
    if 1 <= l <= 12:
        return True
    return False is_yymm if 1 <= l <= 12:
        return True
     1 <= l <= 12 1 <= l 1 l 12 return True True return False False f f l l def is_mmyy(f, l):
    if 1 <= f <= 12:
        return True
    return False is_mmyy if 1 <= f <= 12:
        return True
     1 <= f <= 12 1 <= f 1 f 12 return True True return False False f f l l s = S() s S() S f = int(s[:2]) f int(s[:2]) int s[:2] s :2 2 l = int(s[2:]) l int(s[2:]) int s[2:] s 2: 2 if is_yymm(f, l) and is_mmyy(f, l):
    print('AMBIGUOUS')

elif is_yymm(f, l) and not(is_mmyy(f, l)):
    print('YYMM')

elif not(is_yymm(f, l)) and is_mmyy(f, l):
    print('MMYY')

else:
    print('NA') is_yymm(f, l) and is_mmyy(f, l) is_yymm(f, l) is_yymm f l is_mmyy(f, l) is_mmyy f l print('AMBIGUOUS') print 'AMBIGUOUS' elif is_yymm(f, l) and not(is_mmyy(f, l)):
    print('YYMM') is_yymm(f, l) and not(is_mmyy(f, l)) is_yymm(f, l) is_yymm f l not(is_mmyy(f, l)) is_mmyy(f, l) is_mmyy f l print('YYMM') print 'YYMM' elif not(is_yymm(f, l)) and is_mmyy(f, l):
    print('MMYY') not(is_yymm(f, l)) and is_mmyy(f, l) not(is_yymm(f, l)) is_yymm(f, l) is_yymm f l is_mmyy(f, l) is_mmyy f l print('MMYY') print 'MMYY' print('NA') print 'NA' def is_yymm(f, l):
    if 1 <= l <= 12:
        return True
    return False def is_yymm(f, l):
    if 1 <= l <= 12:
        return True
    return False is_yymm def is_mmyy(f, l):
    if 1 <= f <= 12:
        return True
    return False def is_mmyy(f, l):
    if 1 <= f <= 12:
        return True
    return False is_mmyy def S(): return input() def S(): return input() S def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input l = int(s[2:]) int(s[2:]) l def LIR(n): return [LI() for i in range(n)] def LIR(n): return [LI() for i in range(n)] LIR def LS(): return input().split() def LS(): return input().split() LS s = S() S() s def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def I(): return int(input()) def I(): return int(input()) I f = int(s[:2]) int(s[:2]) f def SR(n): return [S() for i in range(n)] def SR(n): return [S() for i in range(n)] SR def IR(n): return [I() for i in range(n)] def IR(n): return [I() for i in range(n)] IR INF = float('inf') float('inf') INF
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def is_yymm(f, l):
    if 1 <= l <= 12:
        return True
    return False


def is_mmyy(f, l):
    if 1 <= f <= 12:
        return True
    return False


s = S()
f = int(s[:2])
l = int(s[2:])

if is_yymm(f, l) and is_mmyy(f, l):
    print('AMBIGUOUS')

elif is_yymm(f, l) and not(is_mmyy(f, l)):
    print('YYMM')

elif not(is_yymm(f, l)) and is_mmyy(f, l):
    print('MMYY')

else:
    print('NA')
