import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

S = rs()

a = int(S[:2])
b = int(S[2:])

if 0 < a <= 12 and 0 < b <= 12:
	print('AMBIGUOUS')
elif 0 < a <= 12:
	print('MMYY')
elif 0 < b <= 12:
	print('YYMM')
else:
	print('NA') import sys, math sys math from collections import defaultdict, deque, Counter from bisect import bisect_left, bisect_right from itertools import combinations, permutations, product from heapq import heappush, heappop from functools import lru_cache input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline rs = lambda: input().strip() rs lambda: input().strip() input().strip() ().strip () input strip ri = lambda: int(input()) ri lambda: int(input()) int(input()) int input() input rl = lambda: list(map(int, input().split())) rl lambda: list(map(int, input().split())) list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split [v]*y for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) [v]*y [v] v y mat = lambda x, y, v: [[v]*y for _ in range(x)] mat lambda x, y, v: [[v]*y for _ in range(x)] [[v]*y for _ in range(x)] x y v mat(y, z, v) for _ in range(x) for _ in range(x) _ range(x) range x for _ in range(x) mat(y, z, v) mat y z v ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] ten lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] [mat(y, z, v) for _ in range(x)] x y z v mod = 1000000007 mod 1000000007 sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 S = rs() S rs() rs 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 if 0 < a <= 12 and 0 < b <= 12:
	print('AMBIGUOUS')
elif 0 < a <= 12:
	print('MMYY')
elif 0 < b <= 12:
	print('YYMM')
else:
	print('NA') 0 < a <= 12 and 0 < b <= 12 0 < a <= 12 0 < a 0 a 12 0 < b <= 12 0 < b 0 b 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 0 < a <= 12:
	print('MMYY') 0 < a <= 12 0 < a 0 a 12 print('MMYY') print 'MMYY' elif 0 < b <= 12:
	print('YYMM') 0 < b <= 12 0 < b 0 b 12 print('YYMM') print 'YYMM' print('NA') print 'NA' mat = lambda x, y, v: [[v]*y for _ in range(x)] lambda x, y, v: [[v]*y for _ in range(x)] mat b = int(S[2:]) int(S[2:]) b input = sys.stdin.readline sys.stdin.readline input rl = lambda: list(map(int, input().split())) lambda: list(map(int, input().split())) rl S = rs() rs() S a = int(S[:2]) int(S[:2]) a ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] lambda x, y, z, v: [mat(y, z, v) for _ in range(x)] ten ri = lambda: int(input()) lambda: int(input()) ri rs = lambda: input().strip() lambda: input().strip() rs mod = 1000000007 1000000007 mod
import sys, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

S = rs()

a = int(S[:2])
b = int(S[2:])

if 0 < a <= 12 and 0 < b <= 12:
	print('AMBIGUOUS')
elif 0 < a <= 12:
	print('MMYY')
elif 0 < b <= 12:
	print('YYMM')
else:
	print('NA')
