import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
        

main()
 import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools math string itertools fractions heapq collections re array bisect sys random time copy functools from collections import deque sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 inf = 10**20 inf 10**20 10 20 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 DR = [1, -1, 0, 0] DR [1, -1, 0, 0] 1 -1 0 0 DC = [0, 0, 1, -1] DC [0, 0, 1, -1] 0 0 1 -1 int(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI int(x)-1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ float(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) F def S(): return input()
      S def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
         main s = S() s S() S if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
     int(s[:2]) > 12 or int(s[:2]) == 0 int(s[:2]) > 12 int(s[:2]) int s[:2] s :2 2 12 int(s[:2]) == 0 int(s[:2]) int s[:2] s :2 2 0 mmyy = False mmyy False mmyy = True mmyy True if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
     int(s[2:]) > 12 or int(s[2:]) == 0 int(s[2:]) > 12 int(s[2:]) int s[2:] s 2: 2 12 int(s[2:]) == 0 int(s[2:]) int s[2:] s 2: 2 0 yymm = False yymm False yymm = True yymm True ans = '' ans '' if yymm and mmyy:
        ans = 'AMBIGUOUS'
     yymm and mmyy yymm mmyy ans = 'AMBIGUOUS' ans 'AMBIGUOUS' if yymm and not mmyy:
        ans = 'YYMM'
     yymm and not mmyy yymm not mmyy mmyy ans = 'YYMM' ans 'YYMM' if not yymm and mmyy:
        ans = 'MMYY'
     not yymm and mmyy not yymm yymm mmyy ans = 'MMYY' ans 'MMYY' if not yymm and not mmyy:
        ans = 'NA'
     not yymm and not mmyy not yymm yymm not mmyy mmyy ans = 'NA' ans 'NA' print(ans) print ans main() main def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
         def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
         main def I(): return int(sys.stdin.readline()) def I(): return int(sys.stdin.readline()) I def F(): return float(sys.stdin.readline()) def F(): return float(sys.stdin.readline()) F def S(): return input()
      def S(): return input()
      S def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF inf = 10**20 10**20 inf def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS DC = [0, 0, 1, -1] [0, 0, 1, -1] DC DR = [1, -1, 0, 0] [1, -1, 0, 0] DR def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()] LI_ mod = 10**9 + 7 10**9 + 7 mod
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
        

main()

