n = int(input())

r = n // 100
l = n % 100

if r <= 12 and 1 <= r:
  if l <= 12 and 1 <= l:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if l <= 12 and 1 <= l:
    print("YYMM")
  else:
    print("NA")
2bf9f845e953f7a44150b978a1394d3dbedd585d
<mask token>

<mask token>
if r <= 12 and 1 <= r:
    if l <= 12 and 1 <= l:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif l <= 12 and 1 <= l:
    print('YYMM')
else:
    print('NA')

n = int(input())
r = n // 100
l = n % 100
if r <= 12 and 1 <= r:
    if l <= 12 and 1 <= l:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif l <= 12 and 1 <= l:
    print('YYMM')
else:
    print('NA')

n = int(input())

r = n // 100
l = n % 100

if r <= 12 and 1 <= r:
  if l <= 12 and 1 <= l:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if l <= 12 and 1 <= l:
    print("YYMM")
  else:
    print("NA")