import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = read().rstrip().decode()

is_YYMM = 1 <= int(S[2:]) <= 12
is_MMYY = 1 <= int(S[:2]) <= 12

if is_YYMM and is_MMYY:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA') import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines S = read().rstrip().decode() S read().rstrip().decode() ().rstrip().decode ().rstrip() ().rstrip () read rstrip decode is_YYMM = 1 <= int(S[2:]) <= 12 is_YYMM 1 <= int(S[2:]) <= 12 1 <= int(S[2:]) 1 int(S[2:]) int S[2:] S 2: 2 12 is_MMYY = 1 <= int(S[:2]) <= 12 is_MMYY 1 <= int(S[:2]) <= 12 1 <= int(S[:2]) 1 int(S[:2]) int S[:2] S :2 2 12 if is_YYMM and is_MMYY:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA') is_YYMM and is_MMYY is_YYMM is_MMYY print('AMBIGUOUS') print 'AMBIGUOUS' elif is_YYMM:
    print('YYMM') is_YYMM print('YYMM') print 'YYMM' elif is_MMYY:
    print('MMYY') is_MMYY print('MMYY') print 'MMYY' print('NA') print 'NA' S = read().rstrip().decode() read().rstrip().decode() S is_MMYY = 1 <= int(S[:2]) <= 12 1 <= int(S[:2]) <= 12 is_MMYY readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline read = sys.stdin.buffer.read sys.stdin.buffer.read read readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines is_YYMM = 1 <= int(S[2:]) <= 12 1 <= int(S[2:]) <= 12 is_YYMM
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = read().rstrip().decode()

is_YYMM = 1 <= int(S[2:]) <= 12
is_MMYY = 1 <= int(S[:2]) <= 12

if is_YYMM and is_MMYY:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA')