import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

s = readline().rstrip()
a = int(s[:2])
b = int(s[2:])
if 0 < a < 13 and 0 < b < 13:
    ans = "AMBIGUOUS"
elif 0 < a < 13:
    ans = "MMYY"
elif 0 < b < 13:
    ans = "YYMM"
else:
    ans = 'NA'
print(ans) import sys sys readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**8) sys.setrecursionlimit sys setrecursionlimit 10**8 10 8 mod = 10**9+7 mod 10**9+7 10**9 10 9 7 INF = 10**18 INF 10**18 10 18 eps = 10**-7 eps 10**-7 10 -7 s = readline().rstrip() s readline().rstrip() ().rstrip () readline rstrip a = int(s[:2]) a int(s[:2]) int s[:2] s :2 2 b = int(s[2:]) b int(s[2:]) int s[2:] s 2: 2 if 0 < a < 13 and 0 < b < 13:
    ans = "AMBIGUOUS"
elif 0 < a < 13:
    ans = "MMYY"
elif 0 < b < 13:
    ans = "YYMM"
else:
    ans = 'NA' 0 < a < 13 and 0 < b < 13 0 < a < 13 0 < a 0 a 13 0 < b < 13 0 < b 0 b 13 ans = "AMBIGUOUS" ans "AMBIGUOUS" elif 0 < a < 13:
    ans = "MMYY" 0 < a < 13 0 < a 0 a 13 ans = "MMYY" ans "MMYY" elif 0 < b < 13:
    ans = "YYMM" 0 < b < 13 0 < b 0 b 13 ans = "YYMM" ans "YYMM" ans = 'NA' ans 'NA' print(ans) print ans INF = 10**18 10**18 INF ans = "AMBIGUOUS" "AMBIGUOUS" ans a = int(s[:2]) int(s[:2]) a eps = 10**-7 10**-7 eps ans = "MMYY" "MMYY" ans readline = sys.stdin.readline sys.stdin.readline readline mod = 10**9+7 10**9+7 mod ans = 'NA' 'NA' ans ans = "YYMM" "YYMM" ans s = readline().rstrip() readline().rstrip() s b = int(s[2:]) int(s[2:]) b
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

s = readline().rstrip()
a = int(s[:2])
b = int(s[2:])
if 0 < a < 13 and 0 < b < 13:
    ans = "AMBIGUOUS"
elif 0 < a < 13:
    ans = "MMYY"
elif 0 < b < 13:
    ans = "YYMM"
else:
    ans = 'NA'
print(ans)
