import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

l = [i for i in range(1,13)]
l = [str(i) if len(str(i))==2 else '0'+str(i) for i in l]

if s[:2] not in l and s[2:] not in l:
    print('NA')
elif s[:2] not in l and s[2:] in l:
    print('YYMM')
elif s[:2] in l and s[2:] not in l:
    print('MMYY')
else:
    print('AMBIGUOUS') import sys sys sys.setrecursionlimit(10**6) sys.setrecursionlimit sys setrecursionlimit 10**6 10 6 s = input() s input() input i for i in range(1,13) for i in range(1,13) i range(1,13) range 1 13 for i in range(1,13) i l = [i for i in range(1,13)] l [i for i in range(1,13)] str(i) if len(str(i))==2 else '0'+str(i) for i in l for i in l i l for i in l str(i) if len(str(i))==2 else '0'+str(i) len(str(i))==2 len(str(i)) len str(i) str i 2 str(i) str i '0'+str(i) '0' str(i) str i l = [str(i) if len(str(i))==2 else '0'+str(i) for i in l] l [str(i) if len(str(i))==2 else '0'+str(i) for i in l] if s[:2] not in l and s[2:] not in l:
    print('NA')
elif s[:2] not in l and s[2:] in l:
    print('YYMM')
elif s[:2] in l and s[2:] not in l:
    print('MMYY')
else:
    print('AMBIGUOUS') s[:2] not in l and s[2:] not in l s[:2] not in l s[:2] s :2 2 l s[2:] not in l s[2:] s 2: 2 l print('NA') print 'NA' elif s[:2] not in l and s[2:] in l:
    print('YYMM') s[:2] not in l and s[2:] in l s[:2] not in l s[:2] s :2 2 l s[2:] in l s[2:] s 2: 2 l print('YYMM') print 'YYMM' elif s[:2] in l and s[2:] not in l:
    print('MMYY') s[:2] in l and s[2:] not in l s[:2] in l s[:2] s :2 2 l s[2:] not in l s[2:] s 2: 2 l print('MMYY') print 'MMYY' print('AMBIGUOUS') print 'AMBIGUOUS' s = input() input() s l = [str(i) if len(str(i))==2 else '0'+str(i) for i in l] [str(i) if len(str(i))==2 else '0'+str(i) for i in l] l l = [i for i in range(1,13)] [i for i in range(1,13)] l
import sys
sys.setrecursionlimit(10**6)

#a = int(input())
#b = list(map(int, input().split()))
#n, m = map(int, input().split())
s = input()
#s,t = input().split()
#a = [int(input()) for _ in range(n)]
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

l = [i for i in range(1,13)]
l = [str(i) if len(str(i))==2 else '0'+str(i) for i in l]

if s[:2] not in l and s[2:] not in l:
    print('NA')
elif s[:2] not in l and s[2:] in l:
    print('YYMM')
elif s[:2] in l and s[2:] not in l:
    print('MMYY')
else:
    print('AMBIGUOUS')