import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()

    f = int(S[:2])
    b = int(S[2:])
    if 1 <= f <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif 1 <= b <= 12:
        print('YYMM')
    elif 1 <= f <= 12:
        print('MMYY')
    else:
        print('NA')

if __name__ == '__main__':
    resolve() import bisect, collections, copy, heapq, itertools, math, string, sys bisect collections copy heapq itertools math string sys input = lambda: sys.stdin.readline().rstrip() input 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 sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 INF = float('inf') INF float('inf') float 'inf' def I(): return int(input()) I def F(): return float(input()) F def SS(): return input() SS int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x def LI(): return [int(x) for x in input().split()] LI int(x)-1 for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x)-1 int(x) int x 1 def LI_(): return [int(x)-1 for x in input().split()] LI_ float(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() float(x) float x def LF(): return [float(x) for x in input().split()] LF def LSS(): return input().split() LSS def resolve():
    S = SS()

    f = int(S[:2])
    b = int(S[2:])
    if 1 <= f <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif 1 <= b <= 12:
        print('YYMM')
    elif 1 <= f <= 12:
        print('MMYY')
    else:
        print('NA') resolve S = SS() S SS() SS f = int(S[:2]) f int(S[:2]) int S[:2] S :2 2 b = int(S[2:]) b int(S[2:]) int S[2:] S 2: 2 if 1 <= f <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif 1 <= b <= 12:
        print('YYMM')
    elif 1 <= f <= 12:
        print('MMYY')
    else:
        print('NA') 1 <= f <= 12 and 1 <= b <= 12 1 <= f <= 12 1 <= f 1 f 12 1 <= b <= 12 1 <= b 1 b 12 print('AMBIGUOUS') print 'AMBIGUOUS' elif 1 <= b <= 12:
        print('YYMM')
     1 <= b <= 12 1 <= b 1 b 12 print('YYMM') print 'YYMM' elif 1 <= f <= 12:
        print('MMYY')
     1 <= f <= 12 1 <= f 1 f 12 print('MMYY') print 'MMYY' print('NA') print 'NA' if __name__ == '__main__':
    resolve() __name__ == '__main__' __name__ '__main__' resolve() resolve def LI_(): return [int(x)-1 for x in input().split()] def LI_(): return [int(x)-1 for x in input().split()] LI_ def F(): return float(input()) def F(): return float(input()) F def LI(): return [int(x) for x in input().split()] def LI(): return [int(x) for x in input().split()] LI def resolve():
    S = SS()

    f = int(S[:2])
    b = int(S[2:])
    if 1 <= f <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif 1 <= b <= 12:
        print('YYMM')
    elif 1 <= f <= 12:
        print('MMYY')
    else:
        print('NA') def resolve():
    S = SS()

    f = int(S[:2])
    b = int(S[2:])
    if 1 <= f <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif 1 <= b <= 12:
        print('YYMM')
    elif 1 <= f <= 12:
        print('MMYY')
    else:
        print('NA') resolve def I(): return int(input()) def I(): return int(input()) I input = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() input def SS(): return input() def SS(): return input() SS INF = float('inf') float('inf') INF def LF(): return [float(x) for x in input().split()] def LF(): return [float(x) for x in input().split()] LF def LSS(): return input().split() def LSS(): return input().split() LSS
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()

    f = int(S[:2])
    b = int(S[2:])
    if 1 <= f <= 12 and 1 <= b <= 12:
        print('AMBIGUOUS')
    elif 1 <= b <= 12:
        print('YYMM')
    elif 1 <= f <= 12:
        print('MMYY')
    else:
        print('NA')

if __name__ == '__main__':
    resolve()
