Problem:
 Score : 200 points    Problem Statement You have a digit sequence S of length 4 . You are wondering which of the following formats S is in:   YYMM format: the last two digits of the year and the two-digit representation of the month (example: 01 for January), concatenated in this order  MMYY format: the two-digit representation of the month and the last two digits of the year, concatenated in this order   If S is valid in only YYMM format, print YYMM ; if S is valid in only MMYY format, print MMYY ; if S is valid in both formats, print AMBIGUOUS ; if S is valid in neither format, print NA .      Constraints  S is a digit sequence of length 4 .         Input Input is given from Standard Input in the following format:  S       Output Print the specified string: YYMM , MMYY , AMBIGUOUS or NA .        Sample Input 1 1905      Sample Output 1 YYMM  May XX19 is a valid date, but 19 is not valid as a month. Thus, this string is only valid in YYMM format.       Sample Input 2 0112      Sample Output 2 AMBIGUOUS  Both December XX01 and January XX12 are valid dates. Thus, this string is valid in both formats.       Sample Input 3 1700      Sample Output 3 NA  Neither 0 nor 17 is valid as a month. Thus, this string is valid in neither format.

Solution (Python):
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']

if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[3])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[2])
elif 0<int(s[:2])<=12:
    print(ans[1])
elif 0<int(s[-2:])<=12:
    print(ans[0])

Solution (Python):
S = list(input())

a = int("".join(S[0:2]))
b = int("".join(S[2:4]))

if 1 <= a <= 12 and 1 <= b <= 12:
    print("AMBIGUOUS")
elif 1 <= a <= 12:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")

Solution (Python):
s=input()
s1=s[0]+s[1]
s2=s[2]+s[3]
n1=int(s1)
n2=int(s2)
if 1<=n1<=12:
    if 1<=n2<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=n2<=12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
s = str(input())
A = int(s[0:2]); B = int(s[2:4])
if 1 <= A <= 12 and 1 <= B <= 12:
    print("AMBIGUOUS")
elif 1 <= A <= 12 and 0 <= B <= 99:
    print("MMYY")
elif 1 <= B <= 12 and 0 <= A <= 99:
    print("YYMM")
else:
    print("NA")

Solution (Python):
from sys import exit
S = input()

if 0 < int(S[0:2]) < 13:
    if 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(S[2:]) < 13:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
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()

Solution (Python):
s = int(input())
s1 = s // 100
s2 = s % 100
c = 0
l = ["NA","YYMM","MMYY","AMBIGUOUS"]
if 1<=s2<=12:
  c += 1
if 1<=s1<=12:
  c += 2
print(l[c])

Solution (Python):
S = input()
S1, S2 = S[0:2], S[2:5]
if (int(S1) >= 1 and int(S1) <=12) and (int(S2) >= 1 and int(S2) <=12):
	print('AMBIGUOUS')
elif int(S2) >= 1 and int(S2) <= 12:
	print('YYMM')
elif int(S1) >= 1 and int(S1) <=12:
	print('MMYY')
else:
	print('NA')

Solution (Python):
S = input().rstrip()
if 1<=int(S[:2])<=12:
    if 1<=int(S[2:])<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=int(S[2:])<=12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s=list(input())
S=[]
for i in range(len(s)):
    S.append(int(s[i]))
if 1<=S[2]*10+S[3] and S[2]*10+S[3]<=12:
    if 1<=S[0]*10+S[1] and S[0]*10+S[1]<=12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if 1<=S[0]*10+S[1] and S[0]*10+S[1]<=12:
        print('MMYY')
    else:
        print('NA')

Solution (Python):
S = input()
sform = int(S[:2])
slatt = int(S[2:])

if sform <= 12 and sform >= 1:
    if slatt <= 12 and slatt >= 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if slatt <= 12 and slatt >= 1:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
s = input()
v=0
for i in range(4):
    v = v*10+int(s[i])
v1 = v//100
v2 = v%100
if 12>=v1>=1 and 12>=v2>=1:
    print("AMBIGUOUS")
elif (v1>=13 or v1==0) and 12>=v2>=1:
    print("YYMM")
elif (v2>=13 or v2==0) and 12>=v1>=1:
    print("MMYY")
else:
    print("NA")

Solution (Python):
s=input()

first_two=int(''.join(s[:2]))
last_two=int(''.join(s[2:]))

if 1<=first_two<=12 and 1<=last_two<=12:
  print('AMBIGUOUS')
elif 1<=last_two<=12:
  print('YYMM')
elif 1<=first_two<=12:
  print('MMYY')
else:
  print('NA')

Solution (Python):
s = list(map(int, input()))
l = [0]*2
l[0] = s[0]*10 + s[1]
l[1] = s[2]*10 + s[3]

F = False
L = False

if 0 < l[0] <= 12:
  F = True
if 0 < l[1] <= 12:
  L = True

if F == True and L == True:
  print('AMBIGUOUS')

elif F == True:
  print('MMYY')

elif L == True:
  print('YYMM')

else:
  print('NA')

Solution (Python):
s = input()
if (int(s[:2]) == 0 or int(s[:2]) > 12)&(0 < int(s[2:]) <= 12):
    print("YYMM")
    
elif (0 < int(s[:2]) <= 12)&(int(s[2:]) == 0 or int(s[2:]) > 12):
    print("MMYY")

elif (0 < int(s[:2]) <= 12)&(0 < int(s[2:]) <= 12):
    print("AMBIGUOUS")

else:
    print("NA")

Solution (Python):
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    if 1 <= int(S[:2]) <= 12:
        is_MMYY = True
    else:
        is_MMYY = False

    if 1 <= int(S[2:]) <= 12:
        is_YYMM = True
    else:
        is_YYMM = False

    if is_MMYY and is_YYMM:
        ans = "AMBIGUOUS"
    elif is_MMYY:
        ans = "MMYY"
    elif is_YYMM:
        ans = "YYMM"
    else:
        ans = "NA"

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
s = input()
a, b = s[:2], s[2:]
if '01' <= a <= '12':
    if '01' <= b <= '12':
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if '01' <= b <= '12':
        print('YYMM')
    else:
        print('NA')

Solution (Python):
s=str(input())
a="Y"
b="Y"
if 0<int(s[0:2])<13:
    a="MY"
if 0<int(s[2:5])<13:
    b="MY"

if a==b=="Y":
    ans="NA"
elif a=="Y" and b=="MY":
    ans="YYMM"
elif a=="MY" and b=="Y":
    ans="MMYY"
else:
    ans="AMBIGUOUS"
print(ans)

Solution (Python):
a, b = divmod(int(input()), 100)
x = "MM" if 0 < a < 13 else "YY"
y = "MM" if 0 < b < 13 else "YY"
print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS")

Solution (Python):
s = int(input())
a, b = s // 100, s % 100
x = "YY" if a == 0 or a > 12 else "MM"
y = "YY" if b == 0 or b > 12 else "MM"
print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS")

Solution (Python):
s = int(input())
a, b = s // 100, s % 100
x = "YY" if a == 0 or a > 12 else "MM"
y = "YY" if b == 0 or b > 12 else "MM"
if x != y:
    print(x + y)
else:
    print("NA" if x == "YY" else "AMBIGUOUS")

Solution (Python):
def solve():
    s = input()
    a = int(s[:2])
    if a == 0 or a > 12:
        x = "YY"
    else:
        x = "MM"
    b = int(s[2:])
    if b == 0 or b > 12:
        y = "YY"
    else:
        y = "MM"
    if x + y == "YYYY":
        print("NA")
    elif x + y == "MMMM":
        print("AMBIGUOUS")
    else:
        print(x + y)


solve()

Solution (Python):
s = input()

x = int(s[:2])
y = int(s[2:])

if 1 <= x <= 12 and 1 <= y <= 12:
    print("AMBIGUOUS")
elif 1 <= x <= 12:
    print("MMYY")
elif 1 <= y <= 12:
    print("YYMM")
else:
    print('NA')

Solution (Python):
S = input()
a,b = int(S[:2]),int(S[2:])
if (1<=a and a<=12) or (1<=b and b<=12):
    if (1<=a and a<=12) and (1<=b and b<=12): 
        print("AMBIGUOUS")
    elif (1<=b and b<=12):
        print("YYMM")
    elif  (1<=a and a<=12): 
        print("MMYY")
  
else:
    print("NA")

Solution (Python):
s=input()
flag1=0
flag2=0
if 0<int(s[:2])<13:
  flag1=1
else:
  pass
if 0<int(s[2:])<13:
  flag2=1
else:
  pass

if flag1==0 and flag2==0:
  print("NA")
elif flag1==1 and flag2==0:
  print("MMYY")
elif flag1==0 and flag2==1:
  print("YYMM")
else:
  print("AMBIGUOUS")

Solution (Python):
S = int(input())

if 0 < S//100 < 13:
    if 0 < S%100 < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < S%100 < 13:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
S = input()

if int(S[0:2]) > 12 or S[0:2] == "00":
    if 0 < int(S[2:4]) <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if 0 < int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

Solution (Python):
s = input()
s1 = int(s[0:2])
s2 = int(s[2:])

if s1 > 0 and s1 < 13:
    if s2 > 0 and s2 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s2 > 0 and s2 < 13:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s=input()
a=int(s[:2])
b=int(s[2:])
if (a > 12 or a == 0) and (b > 12 or b == 0):
	print("NA")
elif a > 12 or a == 0:
	print("YYMM")
elif b > 12 or b == 0:
	print("MMYY")
else: print("AMBIGUOUS")

Solution (Python):
s = input()
bef = s[:2]
aft = s[2:]

if 1 <= int(bef) <= 12:
    if 1 <= int(aft) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= int(aft) <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s=input()
a=int(s[0:2])
b=int(s[2:4])
if 0<a<13:
  if 0<b<13:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0<b<13:
    print('YYMM')
  else:
    print('NA')

Solution (Python):
s = input()
a, b = int(s[:2]), int(s[2:])

if 1<=a<=12 and 1<=b<=12:
  print('AMBIGUOUS')
elif 1<=b<=12:
  print('YYMM')
elif 1<=a<=12:
  print('MMYY')
else:
  print('NA')

Solution (Python):
S = input()
if 0 < int(S[:2]) < 13 and 0 < int(S[2:]) < 13:
    print('AMBIGUOUS')
elif 0 < int(S[:2]) < 13:
    print('MMYY')
elif 0 < int(S[2:]) < 13:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()
a, b = int(s[:2]), int(s[2:])
r = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]
print(r[(0 if (0 < b < 13) else 2) + (0 if (0 < a < 13) else 1)])

Solution (Python):
s = input()
a = int(s[:2])
b = int(s[2:])
if 1 <= a <= 12:
    if 1 <= b <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= b <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()

front = int(S[:2])
rear = int(S[2:])

if (front > 12 and rear > 12) or (front > 12 and rear == 0) or (rear > 12 and front == 0) or (front == 0 and rear == 0):
    print("NA")
    exit()
elif 0 < rear <= 12 and (front > 12 or front == 0):
    print("YYMM")
    exit()
elif 0 < front <= 12 and (rear > 12 or rear == 0):
    print("MMYY")
elif 0 < front <= 12 and 0 < rear <= 12:
    print("AMBIGUOUS")

Solution (Python):
S = input()
YYMM = 0
MMYY = 0
start = S[0:2]
end = S[2:4]
tmp1 = int(start)
tmp2 = int(end)
if(tmp2 <= 12 and tmp2 != 0):
    YYMM = 1
if(tmp1 <= 12 and tmp1 != 0):
    MMYY = 1
if(YYMM == 1 and MMYY == 1):
    print("AMBIGUOUS")
elif(YYMM == 1):
    print("YYMM")
elif(MMYY == 1):
    print("MMYY")
else:
    print("NA")

Solution (Python):
s = input()
mae = int(s[:2])
ato = int(s[2:])

flag1 = 0
flag2 = 0
if 0<mae and mae<=12:
    flag1 = 1
if 0<ato and ato<=12:
    flag2 = 1

if flag1 == 1 and flag2 == 1:
    print('AMBIGUOUS')
elif flag1 == 1:
    print('MMYY')
elif flag2 == 1:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input()
ANS = {0:'NA', 1:'YYMM', 2:'MMYY', 3:'AMBIGUOUS'}
ans = 0
if '00' <= S[:2] <= '99' and '01' <= S[2:] <= '12':
    ans += 1
if '00' <= S[2:] <= '99' and '01' <= S[:2] <= '12':
    ans += 2
print(ANS[ans])

Solution (Python):
def m(s):
  return True if 1 <= int(s) <= 12 else False

s = input()
f = int(s[:2])
l = int(s[2:])

if m(f) and m(l):
  print("AMBIGUOUS")
elif m(f):
  print("MMYY")
elif m(l):
  print("YYMM")
else:
  print("NA")

Solution (Python):

s = list(input())

s1 = int("".join(s[:2]))

s2 = int("".join(s[2:]))


if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = list(input())
s1 = int("".join(s[:2]))
s2 = int("".join(s[2:]))

if 1 <= s1 <= 12 and 1 <= s2 <= 12:
    print('AMBIGUOUS')
elif 1 <= s1 <= 12:
    print('MMYY')
elif 1 <= s2 <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S=input()
A=int(S[0:2])
B=int(S[2:4])
if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA")

Solution (Python):
s=input()
if 1<=int(s[:2])<=12:
    if 1<=int(s[2:])<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=int(s[2:])<=12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()
A = int(S[0] + S[1])
B = int(S[2] + S[3])

if 1 <= A <= 12 and 1 <= B <= 12:
    print('AMBIGUOUS')
elif (A > 12 or A <= 0) and 1 <= B <= 12:
    print('YYMM')
elif 1 <= A <= 12 and (B > 12 or B <= 0):
    print('MMYY')
else:
    print('NA')

Solution (Python):
s = input()

s_a = int(s[:2])
s_b = int(s[2:])

if 1 <= s_a <=12 and 1 <= s_b <=12:
  ans = "AMBIGUOUS"
elif not(1 <= s_a <=12) and 1 <= s_b <=12:
  ans = "YYMM"
elif 1 <= s_a <=12 and not(1 <= s_b <=12):
  ans = "MMYY"
else:
  ans = "NA"

print(ans)

Solution (Python):
s = input()

s_a = int(s[:2])
s_b = int(s[2:])

if s_a >= 1 and s_a <=12 and s_b >= 1 and s_b <=12:
  ans = "AMBIGUOUS"
elif (s_a > 12 or s_a == 0) and s_b >= 1 and s_b <=12:
  ans = "YYMM"
elif (s_b > 12 or s_b == 0) and s_a >= 1 and s_a <=12:
  ans = "MMYY"
else:
  ans = "NA"

print(ans)

Solution (Python):
S = input()
f = int(S[:2])
b = int(S[2:])
if (not 0 < f <= 12) and 0 < b <= 12:
    print('YYMM')
elif (not 0 < b <= 12) and 0 < f <= 12:
    print('MMYY')
elif 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):
s = input()
s1 = s[:2]
s2 = s[2:]

if 1 <=int(s1) <= 12:
    if 1 <= int(s2) <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= int(s2) <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
S = input()
left = int(S[:2])
right = int(S[2:])
year_flag = [0, 0]

if left > 12 or left == 0:
    year_flag[0] += 1
if right > 12 or right == 0:
    year_flag[1] += 1

if sum(year_flag) == 2:
    print('NA')
elif sum(year_flag) == 0:
    print('AMBIGUOUS')
elif year_flag[0] == 1:
    print('YYMM')
else:
    print('MMYY')

Solution (Python):
S = input()
n1 = int(S[:2])
n2 = int(S[2:])

if 1 <= n1 <= 12 and 1 <= n2 <= 12:
    print('AMBIGUOUS')
elif 1 <= n1 <= 12 and (not 1 <= n2 <= 12):
    print('MMYY')
elif (not 1 <= n1 <= 12) and 1 <= n2 <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s=input()
ym=True if 0 < int(s[2:]) < 13 else False
my=True if 0 < int(s[:2]) < 13 else False
if my and ym:
  print('AMBIGUOUS')
elif my:
  print('MMYY')
elif ym:
  print('YYMM')
else:
  print('NA')

Solution (Python):
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7

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)

Solution (Python):
x=int(input())
f=x//100
d=x%100
ff=bool(1)
dd=bool(1)
if f==0 or f>12:
  ff=0
if d==0 or d>12:
  dd=0

if ff==1 and dd==1:
  print("AMBIGUOUS")
elif ff==0 and dd==0:
  print("NA")
else:
  if ff==1 and dd==0:
    print("MMYY")
  else:
    print("YYMM")

Solution (Python):
s = input()

n1 = s[0:2]
n2 = s[2:4]

if int(n1) > 12 and int(n2) > 12:
    out_print = 'NA'

elif int(n1) <= 12 and int(n2) <= 12:
    out_print = 'AMBIGUOUS'
    if int(n1) == 0 and int(n2)!=0:
        out_print = 'YYMM'
    elif int(n1) != 0 and int(n2) == 0:
        out_print = 'MMYY'
    elif int(n1)==0 and int(n2)==0:
        out_print = 'NA'

elif int(n1) <= 12 and int(n2) >12:
    out_print = 'MMYY'
    if int(n1) == 0:
        out_print = 'NA'

elif int(n1) > 12 and int(n2) <= 12:
    out_print = 'YYMM'
    if int(n2) == 0:
        out_print = 'NA'
print(out_print)

Solution (Python):







s = input()

temp1 = int(s[0:2])
temp2 = int(s[2:4])

if temp1 >= 1 and temp1 <= 12:
    if (temp2 < 1 or temp2 > 12):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if (temp2 >= 1 and temp2 <= 12):
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = int(input())
b=S%100
a=S//100
if 1<=a<=12 and 1<=b<=12:
    print('AMBIGUOUS')

elif 1<=a<=12:
    print('MMYY')

elif 1<=b<=12:
    print('YYMM')

else:
    print('NA')

Solution (Python):
S=input()
A=int(S[0:2])
B=int(S[2:4])
if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA")

Solution (Python):
s  = input()
l = int(s[0]) * 10 + int(s[1])
r = int(s[2]) * 10 + int(s[3])

res = "NA"
if l == 0:
    if 1 <= r <= 12:
        res = "YYMM"
    else:
        res = "NA"
elif 1 <= l <= 12:
    if 1 <= r <= 12:
        res ="AMBIGUOUS"
    else:
        res = "MMYY"
else:
    if 1 <= r <= 12:
        res = "YYMM"
    else:
        res = "NA"

print(res)

Solution (Python):
S = input()
L = int(S[0:2])
R = int(S[2:4])
if 0 < L <= 12 and 0 < R <= 12:
    print("AMBIGUOUS")
elif 0 < L <= 12:
    print("MMYY")
elif 0 < R <= 12:
    print("YYMM")
else:
    print("NA")

Solution (Python):



s = int(input())
a = s // 100
b = s % 100
if 1 <= a <= 12:
    if 1 <= b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):





S = str(input())
a = int(S[:2])
b = int(S[2:])


if a == 0:
  if b == 0:
    print("NA")
  elif b < 13:
    print("YYMM")
  else:
    print("NA")
  quit()  
elif b == 0:
  if a < 13:
    print("MMYY")
  else:
    print("NA")
  quit()  


if (a > 12) and (b > 12):
  print("NA")
elif (a <= 12) and (b <= 12):
  print("AMBIGUOUS")
elif a <= 12:
  print("MMYY")
else:
  print("YYMM")

Solution (Python):
NN = input()
AA = int(NN[0:2])
BB = int(NN[2:])

count1 = 0
count2 = 0
if AA > 12 or AA == 00:
  count1 +=1
if BB > 12 or BB == 00:
  count2 +=1
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA')

Solution (Python):
S = input()
high = int(S[0:2])
low = int(S[2:4])

if 1<= high <= 12:
    if 1<= low <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
if high < 1 or high > 12:
    if 1<= low <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s = input()
first = int(s[:2])
second = int(s[2:])

month = [False,False]


if(1 <= first and first <= 12):
    month[0] = True

if(1 <= second and second <= 12):
    month[1] = True
    
if(month[0] & month[1]):
    print('AMBIGUOUS')
elif(month[0]):
    print('MMYY')
elif(month[1]):
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()
a = int(s[:2])
b = int(s[2:])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif a<=99 and 0<b<=12:
    print('YYMM')
elif 0<a<=12 and b<=99:
    print('MMYY')
else:
    print('NA')

Solution (Python):
S=input()
a,b=int(S[:2]),int(S[2:])
if 0<a<13 and 0<b<13:
    print('AMBIGUOUS')
elif 0<a<13:
    print('MMYY')
elif 0<b<13:
    print('YYMM')
else:
    print('NA')

Solution (Python):
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)
                
def gcd(a,b):
    while b:
        a=a%b
        b,a=a,b
    return a

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r
    
def solve():
    s=input()
    m=0
    y=0
    if (int(s[-1])>=1 and int(s[-2])==0) or (int(s[-2])==1 and int(s[-1])<=2):
        m=1
    if (int(s[0])==0 and int(s[1])>=1) or (int(s[0])==1 and  int(s[1])<=2):
        y=1
    if m and y:
        print("AMBIGUOUS")
    elif m and not y:
        print("YYMM")
    elif y and not m:
        print("MMYY")
    else:
        print("NA")
        
    



for _ in range(1):
    solve()

Solution (Python):
s=input();r=''.join(['MM'if 1<=i<=12 else'YY'for i in list(map(int,(s[:2],s[2:])))]);print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY'])

Solution (Python):
s=input();r=''.join(['MM' if 1<=i<=12 else 'YY' for i in list(map(int,(s[:2],s[2:])))]);print(r if r!='MMMM'and r!='YYYY'else ['AMBIGUOUS','NA'][r=='YYYY'])

Solution (Python):
s=input();a,b=map(int,(s[:2],s[2:]));print('AMBIGUOUS'if 1<=a<=12 and 1<=b<=12 else'MMYY'if 1<=a<=12 and 0<=b<=99 else'YYMM'if 0<=a<=99 and 1<=b<=12 else'NA')

Solution (Python):
S=input()
if 1 <= int(S[:2]) <=12 and 1 <= int(S[2:]) <= 12:
  print("AMBIGUOUS")
elif 1 <= int(S[:2]) <= 12:
  print("MMYY")
elif 1 <= int(S[2:]) <= 12:
  print("YYMM")
else:
  print("NA")

Solution (Python):
s = input()
b1 = 1 <= int(s[:2]) <= 12
b2 = 1 <= int(s[2:]) <= 12
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
print(ans[2*b1 + b2])

Solution (Python):
s = input()
s1, s2 = int(s[:2]), int(s[2:])
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
print(ans[((1 <= s1 <= 12) << 1) + (1 <= s2 <= 12)])

Solution (Python):
S=input()
a,b=int(S[:2]),int(S[2:])
if 0<a<13 and 0<b<13:
    print('AMBIGUOUS')
elif 0<a<13:
    print('MMYY')
elif 0<b<13:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = int(input())
a = s//100
b = s%100
if 0 < b and b < 13 and 0 < a and a < 13:
    print("AMBIGUOUS")
elif 0 < b and b < 13:
    print("YYMM")
elif 0 < a and a < 13:
    print("MMYY")
else:
    print("NA")

Solution (Python):
s=input()
if int(s[:2])<=12 and int(s[:2])>0:
    if int(s[2:4])<=12 and int(s[2:4])>0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif int(s[2:4])<=12 and int(s[2:4])>0:
    print("YYMM")
else:
    print("NA")

Solution (Python):
a = input()
if int(a[:2]) < 13 and int(a[:2]) > 0:
    if int(a[2:4]) < 13 and int(a[2:4]) > 0: print('AMBIGUOUS')
    else: print('MMYY')
elif int(a[2:]) < 13 and int(a[2:]) > 0: print('YYMM')
else: print('NA')

Solution (Python):

import os
import sys
from io import BytesIO, IOBase




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")


class union_find:
    def __init__(self, n):
        self.n = n
        self.rank = [0]*n
        self.parent = [int(j) for j in range(n)]
    
    def union(self,i,j):
        i = self.find(i)
        j = self.find(j)
        if self.rank[i] == self.rank[j]:
            self.parent[i] = j
            self.rank[j] += 1

        elif self.rank[i] > self.rank[j]:
            self.parent[j] = i
        else:
            self.parent[i] = j

    def find(self, i):
        temp = i
        if self.parent[temp] != temp:
            self.parent[temp] = self.find(self.parent[temp])
        return self.parent[temp]
def main():

    
    
    s = input()
    if(1<=int(s[:2])<=12 and 1<=int(s[2:])<=12):
        print("AMBIGUOUS")
    elif(1<=int(s[2:])<=12):
        print("YYMM")
    elif(1<=int(s[:2])<=12):
        print("MMYY")
    else:
        print("NA")

    
    
        





        
                
            
        


        
        




        




if __name__ == "__main__":
    main()

Solution (Python):
s = input()
a = int(s[:2])
b = 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')

Solution (Python):
s = input()
a = int(s[:2]) 
b = 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')

Solution (Python):
s = input()
s1, s2 = s[:2],s[2:]
if s1>'12' and s2>'12':
    print('NA')
elif s1<='12' and s2<='12':
    if s1 == '00' and s2!='00':
        print('YYMM')
    elif s2 == '00' and s1!='00':
        print('MMYY')
    elif s1 =='00' and s2 =='00':
        print('NA')
    else :
        print('AMBIGUOUS')
elif s1<='12' and s2>'12':
    print('NA' if s1 == '00' else 'MMYY')   
elif s2<='12' and s1>'12':
    print('NA' if s2 == '00' else 'YYMM')
else:
    print('NA')

Solution (Python):
def main():
    S = str(input())
    front = int(S[0:2])
    latter = int(S[2:4])
    if front < 13 and latter < 13 and (front > 0 and latter > 0):
        print('AMBIGUOUS')
    elif front < 13 and latter < 100 and front > 0:
        print('MMYY')
    elif front < 100 and latter < 13 and latter > 0:
        print('YYMM')
    else:
        print('NA')
main()

Solution (Python):


def main():

    S = input()

    listS = [int(S[:2]), int(S[2:])]

    if 1 <= listS[0] <= 12 and 1 <= listS[1] <= 12:
        ans = 'AMBIGUOUS'

    elif 1 <= listS[0] <= 12:
        ans = 'MMYY'

    elif 1 <= listS[1] <= 12:
        ans = 'YYMM'

    else:
        ans = 'NA'

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
S=input()
s1,s2=int(S[:2]),int(S[2:])
if 1<=s1<=12 and 1<=s2<=12:print('AMBIGUOUS')
elif 1<=s1<=12:print('MMYY')
elif 1<=s2<=12:print('YYMM')
else:print('NA')

Solution (Python):
S=input()
if int(S[0]+S[1])>0 and int(S[0]+S[1])<13:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if int(S[2]+S[3])>0 and int(S[2]+S[3])<13:
    print("YYMM")
  else:
    print("NA")

Solution (Python):
S = int(input())
S1, S2 = S // 100, S % 100

YYMM = (1 <= S2 and S2 <= 12)
MMYY = (1 <= S1 and S1 <= 12)

if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Solution (Python):
s = input()
a = int(s[:2])
b = 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")

Solution (Python):
s = input()
a = int(s[:2])
b = 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")

Solution (Python):
S = input()
head = S[:2]
tail = S[2:]

MMYY = False
YYMM = False

if 1 <= int(head) <= 12:
    MMYY = True
if 1 <= int(tail) <= 12:
    YYMM = True

if MMYY and YYMM:
    print("AMBIGUOUS")
elif MMYY:
    print("MMYY")
elif YYMM:
    print("YYMM")
else:
    print("NA")

Solution (Python):
S = input()
flagA = False
flagB = False
if 1 <= int(S[2:4])<= 12:
  flagB = True
if 1 <= int(S[0:2])<= 12:
  flagA = True
if flagA and flagB:
  print("AMBIGUOUS")
elif flagA and not flagB:
  print("MMYY")
elif flagB and not flagA:
  print("YYMM")
else:
  print("NA")

Solution (Python):
S=input()
x=int(S[:2])
y=int(S[2:])
if x==0:
    if 0<y<=12:
        print("YYMM")
    else:
        print("NA")
elif 0<x<=12:
    if 0<y<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif x>=13:
    if 0<y<=12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s = input()

aa = int(s[0])*10 + int(s[1])
bb = int(s[2])*10 + int(s[3])

if 1 <= aa <= 12 and 1 <= bb <= 12 :
    print("AMBIGUOUS")
elif 1 <= aa <= 12 and bb == 0 :
    print("MMYY")
elif 1 <= aa <= 12 and 13 <= bb :
    print("MMYY")
elif aa == 0 and 1<= bb <= 12 :
    print("YYMM")
elif 13<=aa and 1<=bb<=12 :
    print("YYMM")
else :
    print("NA")

Solution (Python):
s=input()
t,u=0<int(s[:2])<13,0<int(s[2:])<13
print('AMBIGUOUS' if t and u else 'MMYY' if t else 'YYMM' if u else 'NA')

Solution (Python):
s = input()

if ((int(s[0])==0 and 1<=int(s[1])<=9)  or (int(s[0]) == 1 and 0<=int(s[1])<=2)) and ((int(s[2])==0 and 1<=int(s[3])<=9)  or (int(s[2]) == 1 and 0<=int(s[3])<=2) ):
  print("AMBIGUOUS")
elif (int(s[0])==0 and 1 <=int(s[1])<=9)  or (int(s[0]) == 1 and 0<=int(s[1])<=2):
  print("MMYY")
elif (int(s[2])==0 and 1 <=int(s[3])<=9)  or (int(s[2]) == 1 and 0<=int(s[3])<=2):
  print("YYMM")
else:
  print("NA")

Solution (Python):
n = input()
ans = 0
if 1 <= int(n[0:2]) <= 12 and 0 <= int(n[2:4]) <= 99:
  ans += 1
if 0 <= int(n[0:2]) <= 99 and 1 <= int(n[2:4]) <= 12:
  ans += 3
if ans == 1:
  print('MMYY')
elif ans == 3:
  print('YYMM')
elif ans == 4:
  print('AMBIGUOUS')
else:
  print('NA')

Solution (Python):
a=input()
n=int(a[0:2])
m=int(a[2:4])
if 0<n<=12 and 0<m<=12:
    print('AMBIGUOUS')
elif 0<n<=12:
    print('MMYY')
elif 0<m<=12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input()
if (int(S[:2])>12 or int(S[:2])==0) and (int(S[2:])>12 or int(S[2:])==0):
    print('NA')
elif (int(S[:2])<=12 and int(S[:2])!=0) and (int(S[2:])>12 or int(S[2:])==0):
    print('MMYY')
elif (int(S[2:])<=12 and int(S[2:])!=0) and (int(S[:2])>12 or int(S[:2])==0):
    print('YYMM')
else:
    print('AMBIGUOUS')