import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
ans = ''
xx = int(s[0:2])
zz = int(s[2:4])
if xx < 13 and zz < 13 and xx != 0 and zz != 0:
    ans = 'AMBIGUOUS'
elif xx < 13 and xx != 0:
    ans = 'MMYY'
elif zz < 13 and zz != 0:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans) import bisect,collections,copy,heapq,itertools,math,string bisect collections copy heapq itertools math string import sys sys def S(): return sys.stdin.readline().rstrip() S def M(): return map(int,sys.stdin.readline().rstrip().split()) M def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def LS(): return list(sys.stdin.readline().rstrip().split()) LS s = S() s S() S ans = '' ans '' xx = int(s[0:2]) xx int(s[0:2]) int s[0:2] s 0:2 0 2 zz = int(s[2:4]) zz int(s[2:4]) int s[2:4] s 2:4 2 4 if xx < 13 and zz < 13 and xx != 0 and zz != 0:
    ans = 'AMBIGUOUS'
elif xx < 13 and xx != 0:
    ans = 'MMYY'
elif zz < 13 and zz != 0:
    ans = 'YYMM'
else:
    ans = 'NA' xx < 13 and zz < 13 and xx != 0 and zz != 0 xx < 13 and zz < 13 and xx != 0 xx < 13 and zz < 13 xx < 13 xx 13 zz < 13 zz 13 xx != 0 xx 0 zz != 0 zz 0 ans = 'AMBIGUOUS' ans 'AMBIGUOUS' elif xx < 13 and xx != 0:
    ans = 'MMYY' xx < 13 and xx != 0 xx < 13 xx 13 xx != 0 xx 0 ans = 'MMYY' ans 'MMYY' elif zz < 13 and zz != 0:
    ans = 'YYMM' zz < 13 and zz != 0 zz < 13 zz 13 zz != 0 zz 0 ans = 'YYMM' ans 'YYMM' ans = 'NA' ans 'NA' print(ans) print ans def M(): return map(int,sys.stdin.readline().rstrip().split()) def M(): return map(int,sys.stdin.readline().rstrip().split()) M def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I ans = 'NA' 'NA' ans ans = '' '' ans zz = int(s[2:4]) int(s[2:4]) zz ans = 'YYMM' 'YYMM' ans s = S() S() s def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI xx = int(s[0:2]) int(s[0:2]) xx ans = 'MMYY' 'MMYY' ans ans = 'AMBIGUOUS' 'AMBIGUOUS' ans def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
ans = ''
xx = int(s[0:2])
zz = int(s[2:4])
if xx < 13 and zz < 13 and xx != 0 and zz != 0:
    ans = 'AMBIGUOUS'
elif xx < 13 and xx != 0:
    ans = 'MMYY'
elif zz < 13 and zz != 0:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)