import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
a, b = int(s[:2]), int(s[2:])
if 0 < a < 13:
  if 0 < b < 13:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0 < b < 13:
    print('YYMM')
  else:
    print('NA')



 import sys sys import math math import itertools itertools import collections collections import heapq heapq import re re import numpy as np numpy rr = lambda: sys.stdin.readline().rstrip() rr lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip rs = lambda: sys.stdin.readline().split() rs lambda: sys.stdin.readline().split() sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split ri = lambda: int(sys.stdin.readline()) ri lambda: int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rm = lambda: map(int, sys.stdin.readline().split()) rm lambda: map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split rl = lambda: list(map(int, sys.stdin.readline().split())) rl lambda: list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split inf = float('inf') inf float('inf') float 'inf' mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 s = rr() s rr() rr a, b = int(s[:2]), int(s[2:]) a int(s[:2]) int s[:2] s :2 2 b int(s[2:]) int s[2:] s 2: 2 if 0 < a < 13:
  if 0 < b < 13:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0 < b < 13:
    print('YYMM')
  else:
    print('NA') 0 < a < 13 0 < a 0 a 13 if 0 < b < 13:
    print('AMBIGUOUS')
  else:
    print('MMYY') 0 < b < 13 0 < b 0 b 13 print('AMBIGUOUS') print 'AMBIGUOUS' print('MMYY') print 'MMYY' if 0 < b < 13:
    print('YYMM')
  else:
    print('NA') 0 < b < 13 0 < b 0 b 13 print('YYMM') print 'YYMM' print('NA') print 'NA' rr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() rr rs = lambda: sys.stdin.readline().split() lambda: sys.stdin.readline().split() rs rm = lambda: map(int, sys.stdin.readline().split()) lambda: map(int, sys.stdin.readline().split()) rm rl = lambda: list(map(int, sys.stdin.readline().split())) lambda: list(map(int, sys.stdin.readline().split())) rl inf = float('inf') float('inf') inf a, b = int(s[:2]), int(s[2:]) int(s[:2]) a s = rr() rr() s b = int(s[:2]), int(s[2:]) int(s[2:]) b ri = lambda: int(sys.stdin.readline()) lambda: int(sys.stdin.readline()) ri mod = 10**9 + 7 10**9 + 7 mod
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
a, b = int(s[:2]), int(s[2:])
if 0 < a < 13:
  if 0 < b < 13:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0 < b < 13:
    print('YYMM')
  else:
    print('NA')




