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 = input()
front = int(S[:2])
back = int(S[2:])


def is_month(num):
    if num >= 1 and num <= 12:
        return True


if is_month(front) and is_month(back):
    print('AMBIGUOUS')
elif is_month(front) and not is_month(back):
    print('MMYY')
elif not is_month(front) and is_month(back):
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input() 

YM1_s = S[:2]
YM2_s = S[2:]

YM1 = int(YM1_s)
YM2 = int(YM2_s)

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

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

Solution (Python):
s = input()
a = s[:2]
b = s[2:]
a = int(a)
b = int(b)
yymm = 0
mmyy = 0
if b >= 1 and b <= 12:
    yymm = 1
if a >= 1 and a <= 12:
    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):

from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')


def A():
    n, k = LI()
    s = S()
    s[k-1] = s[k-1].lower()
    print("".join(s))

    return


def B():
    s = S()
    a = int("".join(s[:2]))
    b = int("".join(s[2:]))
    if 0 < a <= 12:
        if 0 < b <= 12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    elif a == 0:
        if 0 < b <= 12:
            print("YYMM")
        else:
            print("NA")
    else:
        if 0 < b <= 12:
            print("YYMM")
        else:
            print("NA")


    return


def C():
    return


def D():
    return


def E():
    return


def F():
    return


def G():
    return


def H():
    return


if __name__ == '__main__':
    B()

Solution (Python):
s = input()
a, b = s[:2], s[2:]
def check(s1, s2):
    if 0 < int(s1) <= 12 and 0 < int(s2) <= 12:
        return 'AMBIGUOUS'
    elif 0 < int(s1) <= 12:
        return 'MMYY'
    elif 0 < int(s2) <= 12:
        return 'YYMM'
    else:
        return 'NA'
print(check(a, b))

Solution (Python):
S = input()

if 1 <= int(S[0:2]) <= 12 and 1 <= int(S[2:4]) <= 12:
  print("AMBIGUOUS")

elif 1 <= int(S[0:2]) <= 12:
  print("MMYY")
elif 1 <= int(S[2:4]) <= 12:
  print("YYMM")
else: print("NA")

Solution (Python):
s = input()

m1 = False
m2 = False
 
s1 = int(s[0:2])
s2 = int(s[2:])

 
if 0 < s1 < 13:
  m1 = True
 
if 0 < s2 < 13:
  m2 = True
 
if m1 == True and m2 == True:
  print('AMBIGUOUS')
elif m1 == True and m2 == False:
  print('MMYY')
elif m1 == False and m2 == True:
  print('YYMM')
elif m1 == False and m2 == False:
  print('NA')

Solution (Python):
s = int(input())
s1 = s//100
s2 = s%100

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

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

print(ans)

Solution (Python):
accept = input()
first = int(accept[0] + accept[1])
end = int(accept[2] + accept[3])
if first > 12 and end > 12:
    print("NA")
elif first == 0 and end == 0:
    print("NA")
elif first == 0 or first > 12:
    if end == 0:
        print("NA")
    else:
        print("YYMM")
elif end == 0 or end > 12:
    if first == 0:
        print("NA")
    else:
        print("MMYY")
else:
    print("AMBIGUOUS")

Solution (Python):
S = input()
s1 = int(S[0:2])
s2 = int(S[2:4])
def valid_month(n):
	return 1 <= n and n <= 12
def valid_year(n):
	return 0 <= n and n <= 99
if valid_year(s1) and valid_month(s2) and valid_year(s2) and valid_month(s1):
	print('AMBIGUOUS')
elif valid_year(s1) and valid_month(s2):
	print('YYMM')
elif valid_month(s1) and valid_year(s2):
	print('MMYY')
else:
	print('NA')

Solution (Python):
def main():
    S = input()

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


if __name__ == '__main__':
    main()

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

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

Solution (Python):
import bisect

lis = [1, 13]

str = input()
tp = int(str[:2])
bt = int(str[2:])

tplo = bisect.bisect_right(lis, tp)
btlo = bisect.bisect_right(lis, bt)

if tplo == 1:
    if btlo == 1:
        jd = 2
    else:
        jd = 1
else:
    if btlo == 1:
        jd = 0
    else:
        jd = 3

judge = ["YYMM", "MMYY", "AMBIGUOUS", "NA"]

print(judge[jd])

Solution (Python):
def canMonth(value):
    return 1 <= value and value <= 12


S = input()

F = int(S[:2])
B = int(S[2:])
fm = canMonth(F)
bm = canMonth(B)

if fm and bm:
    print('AMBIGUOUS')
elif not fm and not bm:
    print('NA')
elif fm:
    print('MMYY')
else:
    print('YYMM')

Solution (Python):
S = input()

First = S[0:2]
Last  = S[2:4]



First = int(First)
Last = int(Last)

YYMM = False
MMYY = False

if(First>0 and First<13):
	MMYY = True

if(Last>0 and Last<13):
	YYMM = True
	
if(YYMM and MMYY):
	print("AMBIGUOUS")
elif(YYMM):
	print("YYMM")
elif(MMYY):
	print("MMYY")
else:
	print("NA")

Solution (Python):
S = input().rstrip()
be = int(S[:2])
en = int(S[2:])
flag_be = False
flag_en = False
answer = ""
if be <= 12 and be >= 1:
    flag_be = True
if en <= 12 and en >= 1:
    flag_en = True

if flag_be and flag_en:
    answer = "AMBIGUOUS"
elif flag_be == True and flag_en == False:
    answer = "MMYY"
elif flag_be == False and flag_en == True:
    answer = "YYMM"
else:
    answer = "NA"
print(answer)

Solution (Python):
a = int(input())
y = a//100
m = a%100
if 1 <= y <= 12 and 1 <= m <= 12:
	print('AMBIGUOUS')
elif 1 <= y <= 12:
	print('MMYY')
elif 1 <= m <= 12:
	print('YYMM')
else:
	print('NA')

Solution (Python):
s=input()
sy=int(s[:2])
sm=int(s[2:])

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

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

t = s/100

u = s%100

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

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

b = s % 100
a = int((s-b)/100)

flaga = False
flagb = False

if a > 0 and a < 13:
    flaga = True
if b > 0 and b < 13:
    flagb = True

if flaga == True and flagb == True:
    print('AMBIGUOUS')
if flaga == False and flagb == True:
    print('YYMM')
if flaga == True and flagb == False:
    print('MMYY')
if flaga == False and flagb == False:
    print('NA')

Solution (Python):

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

Solution (Python):
S = input()
T = []
T.append("".join(S[0:2]))
T.append("".join(S[2:4]))
MM = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
if (T[0] in MM) and (T[1] in MM):
  print("AMBIGUOUS")
elif (T[0] in MM) and (T[1] not in MM):
  print("MMYY")
elif (T[0] not in MM) and (T[1] in MM):
  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 = input()
s = [S[:2], S[2:]]

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

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

Solution (Python):
import sys

def isM(s):
    if (s[0] == '0' and '1'<=s[1]<='9' ) or \
        (s[0] == '1' and s[1] in ('0', '1', '2')):
        return True
    return False

if __name__ == '__main__':
    input = sys.stdin.read()
    F, S = input[:2], input[2:]
    if isM(F) and not isM(S): print "MMYY"
    elif not isM(F) and isM(S): print "YYMM"
    elif isM(F) and isM(S): print "AMBIGUOUS"
    else: print 'NA'

Solution (Python):
S = input()
if int(S[:2]) in range(1, 13) and int(S[2:]) in range(1, 13):
  print("AMBIGUOUS")
elif int(S[:2]) in range(100) and int(S[2:]) in range(1, 13):
  print("YYMM")
elif int(S[:2]) in range(1, 13) and int(S[2:]) in range(100):
  print("MMYY")
else:
  print("NA")

Solution (Python):
def judge_yymm(aa,bb):
	if 0<bb<13:
		return True
	return False
	
def judge_mmyy(aa,bb):
	if 0<aa<13:
		return True
	return False

s=input()
num=int(s)

aa,bb=num//100,num%100

if judge_mmyy(aa,bb):
	if judge_yymm(aa,bb):
		print('AMBIGUOUS')
	else:
		print('MMYY')
else:
	if judge_yymm(aa,bb):
		print('YYMM')
	else:
		print('NA')

Solution (Python):
def main():
    S = input()
    upper = int(S[:2])
    lower = int(S[2:4])
    s = ''
    if upper <= 12 and upper > 0:
        s += 'MM'

    else:
        s += 'YY'

    if lower <= 12 and lower > 0:
        s += 'MM'

    else:
        s += 'YY'

    if s == 'MMMM':
        print('AMBIGUOUS')

    elif s == 'YYYY':
        print('NA')

    else:
        print(s)


if __name__ == '__main__':
    main()

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

x, y = divmod(n, 100)

can_month1 = 1 <= x <= 12
can_month2 = 1 <= y <= 12

ans = "NA"
if can_month1 and can_month2:
    ans = "AMBIGUOUS"
elif can_month1:
    ans = "MMYY"
elif can_month2:
    ans = "YYMM"

print(ans)

Solution (Python):

S = input()
s_for, s_back = int(S[:2]), int(S[2:])

if s_for >=1and s_for <= 12:
    if s_back >= 1 and s_back <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s_back >= 1 and s_back <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()
A = S[:2]
B = S[2:]



month = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']

A_month = True
try:
  month.index(A)
except ValueError:
  A_month = False
  


B_month = True
try:
  month.index(B)
except ValueError:
  B_month = False
  


if A_month and B_month:
  print('AMBIGUOUS')
elif A_month and not B_month:
  print('MMYY')
elif not A_month and B_month:
  print('YYMM')
else:
  print('NA')

Solution (Python):
sstr=list(input())
sf=[sstr[0],sstr[1]]
sb=[sstr[2],sstr[3]]
if sf[0]=="0":
  sf.pop(0)
if sb[0]=="0":
  sb.pop(0)
fws="".join(sf)
bks="".join(sb)
fwb=[int(n) for n in fws]
bkb=[int(n) for n in bks]
if len(fwb)==2:
    fw=(fwb[0]*10)+(fwb[1])
else:
    fw=fwb[0]
if len(bkb)==2:
    bk=(bkb[0]*10)+(bkb[1])
else:
    bk=bkb[0]
if 1<=fw<=12:
  if 1<=bk<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=bk<=12:
    print("YYMM")
  else:
    print("NA")

Solution (Python):
s = input()
YY = int(s[0] + s[1])
MM = int(s[2] + s[3])
if 0 < YY < 13 and 0 < MM < 13:
    print("AMBIGUOUS")
elif YY >= 0 and 0 < MM < 13:
    print("YYMM")
elif 0 < YY < 13 and MM >= 0:
    print("MMYY")
elif YY <= 0 or 13 <= YY or MM <= 0 or 13 <= MM:
    print("NA")

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

Solution (Python):
S = input()

def MM(S):
    for i in range(1, 13):
        if S == format(str(i).zfill(2)):
            return True
    return False

b0 = MM(S[:2])
b1 = MM(S[2:])

if b0:
    if b1:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b1:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()
lst = [str(i).zfill(2) for i in range(1, 13)]
up = S[0:2]
low = S[2:4]


if up in lst and low in lst:
    ans = "AMBIGUOUS"
elif up in lst and low not in lst:
    ans = "MMYY"
elif up not in lst and low in lst:
    ans = "YYMM"
else:
    ans = "NA"


print(ans)

Solution (Python):
def Check_Year(year):
    if str(year).isdecimal() :
        return 1
    else:
        return 0

def Check_Month(month):
    if 0 < month < 13:
        return 1
    else:
        return 0

input_data = list(input())
head_chrs = int(input_data[0] + input_data[1])

tail_chrs = int(input_data[2] + input_data[3])





result1 = Check_Year(head_chrs) + Check_Month(tail_chrs)


result2 = Check_Year(tail_chrs) + Check_Month(head_chrs)


if result1 == 2 and result2 == 2 :
    print('AMBIGUOUS')
elif result1 == 2 and result2 != 2 :
    print('YYMM')
elif result1 != 2 and result2 == 2 :
    print('MMYY')
else :
    print('NA')

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

if 12 >= int(S[0:2]) >= 1:

    if 12 >= int(S[2:4]) >= 1:
        print("AMBIGUOUS")

    else:
        print("MMYY")

else:
    if 12 >= int(S[2:4]) >= 1:
        print("YYMM")

    else:
        print("NA")

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

Solution (Python):
print(["NA","YYMM","MMYY","AMBIGUOUS"][(lambda x:(0<x//100 and x//100<13)*2+(0<x%100 and x%100<13))(int(input()))])

Solution (Python):
s = str(input())

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

Solution (Python):
'''input
1700
'''

s = input()

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

pir = False
ant = False

if a and a <= 12:
	pir = True

if b and b <= 12:
	ant = True

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

Solution (Python):
S = int(input())
if 1 <= S / 100 and S / 100 <= 12:
	if 1 <= S % 100 and S % 100 <= 12: print("AMBIGUOUS")
	else: print("MMYY")
else:
	if 1 <= S % 100 and S % 100 <= 12: print("YYMM")
	else: print("NA")

Solution (Python):
def solve():
    s = input()
    if len(str(s)) != 4:
        raise Exception('Error')
    if not (s.isdecimal()):
        print('NA')
    else:
        sl = list(s)
        st = int("".join(sl[:2]))
        end = int("".join(sl[2:4]))
        if st > 0 and st <= 12 and end > 0 and end <= 12:
            print('AMBIGUOUS')
        elif st > 0 and st <= 12 and (end == 0  or end > 12):
            print('MMYY')
        elif (st == 0 or st > 12) and end > 0 and end <= 12:
            print('YYMM')
        else:
            print('NA')

if __name__ == '__main__':
    solve()

Solution (Python):
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(9<s<1e3)-(0<s%100<13)*2])

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

Solution (Python):
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(9<s<1e3)-(0<s%100<13)*2])

Solution (Python):
S = input().rstrip()
front = int(S[0:2])
back = int(S[2:4])

f = True if 1 <= front <= 12 else False
b = True if 1 <= back <= 12 else False

if f and b:
    print('AMBIGUOUS')
elif f:
    print('MMYY')
elif b:
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(9<s<1300)-(0<s%100<13)*2])

Solution (Python):
S = input()
A = int(S[:2])
B = int(S[2:])
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 = list(str(input()))
a = int(s[0]+s[1])
b = int(s[2]+s[3])
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()

if int(S[2:]) in range(1, 13):
    if int(S[:2]) not in range(1, 13):
        print("YYMM")
    else:
        print("AMBIGUOUS")
elif int(S[:2]) in range(1, 13):
    if int(S[2:]) not in range(1, 13):
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    print("NA")

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

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

Solution (Python):
s=int(input());print(['NA','MMYY','YYMM','AMBIGUOUS'][(99<s<1300)-(0<s%100<13)*2])

Solution (Python):
S = input()
XX, YY = int(S[:2]), int(S[2:])

msg = ["NA", "MMYY", "YYMM", "AMBIGUOUS"]

id = 0
if 0 < XX <= 12:
    id += 1
if 0 < YY <= 12:
    id += 2

print(msg[id])

Solution (Python):
S = input()
first, second = map(int, (S[:2], S[2:]))
cond1, cond2 = 1 <= int(first) <= 12, 1 <= int(second) <= 12

if cond1:  
    ans = 'AMBIGUOUS' if cond2 else 'MMYY'
else:
    ans = 'YYMM' if cond2 else 'NA'
print(ans)

Solution (Python):
s=input()
n=int(s[:2])
m=int(s[2:])
if 1<=n<=12:
  if 1<=m<=12:
    print("ambiguous".upper())
    exit()
  else:
    print("MMYY")
    exit()
if 1<=m<13:
  print("YYMM")
  exit()
print("NA")

Solution (Python):
s=input();print(['NA','MMYY','YYMM','AMBIGUOUS'][('01'<s<'13')-('00'<s[2:]<'13')*2])

Solution (Python):
n = input()

l = int(n[:2])
r = int(n[2:])

l = l > 0 and l <= 12
r = r > 0 and r <= 12
if l and r:
    print('AMBIGUOUS')
elif l and not r:
    print('MMYY')
elif (not l) and r:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s=input();print(['NA','MMYY','YYMM','AMBIGUOUS'][(0<int(s[:2])<13)-(0<int(s[2:])<13)*2])

Solution (Python):
s=input();a,b=int(s[:2]),int(s[2:]);print(['NA','MMYY','YYMM','AMBIGUOUS'][(0<a<13)-(0<b<13)*2])

Solution (Python):
s = input()

a = int(s[0:2])
b = int(s[2:4])

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

Solution (Python):
import sys
input = sys.stdin.readline
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
isS1YYMM = 1 <= s1 <= 12
isS2MMYY = 1 <= s2 <= 12
if isS1YYMM:
    if isS2MMYY:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if isS2MMYY:
        print("YYMM")
    else:
        print('NA')

Solution (Python):
s=input()
first=int(s[0]+s[1])
second=int(s[2]+s[3])
if 1<=first<=12 and 1<=second<=12:
	print("AMBIGUOUS")
elif 1<=first<=12 and (second==0 or second>=13):
		print("MMYY")
elif (first==0 or first>=13) and 1<=second<=12:
		print("YYMM")
else:
		print("NA")

Solution (Python):

S = input()

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

ans = (
    'YYMM' if not 1 <= a <= 12 and 1 <= b <= 12 else
    'MMYY' if 1 <= a <= 12 and not 1 <= b <= 12 else
    'AMBIGUOUS' if 1 <= a <= 12 and 1 <= b <= 12 else
    'NA'
)


print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
s = input()
s1 = int(s[:2])
s2 = int(s[2:])
isS1MM = 1 <= s1 <= 12
isS2MM = 1 <= s2 <= 12
if isS1MM and isS2MM:
    print("AMBIGUOUS")
elif not isS1MM and isS2MM:
    print("YYMM")
elif isS1MM and not isS2MM:
    print("MMYY")
else:
    print('NA')

Solution (Python):
S = input().rstrip()
front = int(S[0:2])
back = int(S[2:4])

if 1 <= front <= 12:
    if 1 <= back <= 12:
        print('AMBIGUOUS')
    elif 0 <= back:
        print('MMYY')
    else:
        print('NA')
else:
    if 0 <= front and 1 <= back <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def is_MM(s):
    num = int(s)
    return 0 < num <= 12


def solve():
    N = ii(str)
    ans_pattern = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
    ans = 0
    pre = N[:2]
    post = N[2:]
    if is_MM(post):
        ans += 1
    if is_MM(pre):
        ans += 2
    return ans_pattern[ans]


if __name__ == "__main__":
    print(solve())

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_ints_list = lambda:list(input_ints())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,input_func:[input_func() for _ in range(n)]

import importlib
import_module = lambda module_name:importlib.import_module(module_name)

init_array_1dim = lambda value,n:[value]*n 
init_array_2dim = lambda value,n,m:[init_array_1dim(value,n) for _ in range(m)] 

gcd_base = lambda value1,value2:import_module('fractions').gcd(value1,value2) 
gcd = lambda lst:import_module('functools').reduce(gcd_base,lst) 
lcm_base = lambda value1,value2:(value1*value2)//gcd_base(value1,value2) 
lcm = lambda lst:import_module('functools').reduce(lcm_base,lst,1) 

permutations = lambda lst,n:import_module('itertools').permutations(lst,n) 
combinations = lambda lst,n:import_module('itertools').combinations(lst,n) 
product = lambda lst1,lst2:import_module('itertools').product(lst1,lst2) 

round = lambda value:round(value) 
ceil = lambda value:import_module('math').ceil(value) 
floor = lambda value:import_module('math').floor(value) 


init_q = lambda lst: import_module('collections').deque(lst)
q_pop = lambda q: q.popleft() 
q_push = lambda q,value:q.appendleft(value) 
q_pushlist = lambda q,lst:q.extendleft(lst) 
q_append = lambda q,value:q.append(value) 
q_appendlist = lambda q,lst:q.extend(lst) 


init_heap = lambda a:import_module('heapq').heapify(a)
heap_push = lambda a,v:import_module('heapq').heappush(a,v)
heap_pop = lambda a:import_module('heapq').heappop(a) 

def solution():
    
    S = input_str()

    month_1 = False
    if 1<=int(S[:2])<=12:month_1 = True
    month_2 = False
    if 1<=int(S[2:])<=12:month_2 = True
    
    if month_1 and month_2:
        print('AMBIGUOUS')
        return
    if month_1:
        print('MMYY')
        return
    if month_2:
        print('YYMM')
        return
    print('NA')

if __name__ == '__main__':
    solution()

Solution (Python):
print([((int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "NA" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "AMBIGUOUS" + ((int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "YYMM" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "MMYY" for s in [input()]][0])

Solution (Python):
print([((int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "NA" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "AMBIGUOUS" + ((int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "YYMM" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "MMYY" for s in [input()]][0])

Solution (Python):
print([((int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "NA" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "AMBIGUOUS" + ((int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "YYMM" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "MMYY" for s in [input()]][0])

Solution (Python):


str = list(raw_input())
f = int(str[0]+str[1])
l = int(str[2]+str[3])

if(f > 0 and 13 > f):
    if(l == 0):
        ans = "MMYY"
    if(l > 0 and 13 > l):
        ans = "AMBIGUOUS"
    if(l >= 13):
        ans= "MMYY"
elif(f == 0):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
elif(f>=13):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
print ans

Solution (Python):



n = int(input())

a = n / 100

b = n % 100

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

Solution (Python):
print([((int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "NA" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "AMBIGUOUS" + ((int(s[:2]) == 0 or int(s[:2]) > 12) and not (int(s[2:]) == 0 or int(s[2:]) > 12)) * "YYMM" + (not (int(s[:2]) == 0 or int(s[:2]) > 12) and (int(s[2:]) == 0 or int(s[2:]) > 12)) * "MMYY" for s in [input()]][0])

Solution (Python):


S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 0:
    flag2 = True
    


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

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

Solution (Python):


S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 0:
    flag2 = True
    


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

Solution (Python):


str = list(raw_input())
f = int(str[0]+str[1])
l = int(str[2]+str[3])

if(f > 0 and 13 > f):
    if(l == 0):
        ans = "MMYY"
    if(l > 0 and 13 > l):
        ans = "AMBIGUOUS"
    if(l >= 13):
        ans= "MMYY"
elif(f == 0):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
elif(f>=13):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
print ans

Solution (Python):


S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 0:
    flag2 = True
    


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

Solution (Python):




def main():
	s = input()
	a = int(s[0:2])
	b = int(s[2:4])
	if 1 <= a and a <= 12:
		if 1 <= b and b <= 12:
			print("AMBIGUOUS")
		else:
			print("MMYY")
	else:
		if 1 <= b and b <= 12:
			print("YYMM")
		else:
			print("NA")

if __name__ == '__main__':
	import sys
	sys.exit(main())

Solution (Python):


S = input()
flag1 = False
flag2 = False

num1 = int(S[0] + S[1])
num2 = int(S[2] + S[3])

if num1 >= 0 and (num2 >= 1 and num2 <= 12):
    flag1 = True

if (num1 >= 1 and num1 <= 12) and num2 >= 0:
    flag2 = True
    


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

Solution (Python):


str = list(raw_input())
f = int(str[0]+str[1])
l = int(str[2]+str[3])

if(f > 0 and 13 > f):
    if(l == 0):
        ans = "MMYY"
    if(l > 0 and 13 > l):
        ans = "AMBIGUOUS"
    if(l >= 13):
        ans= "MMYY"
elif(f == 0):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
elif(f>=13):
    if(l == 0):
        ans = "NA"
    if(l > 0 and 13> l):
        ans = "YYMM"
    if(l >= 13):
        ans= "NA"
print ans

Solution (Python):
S = input()

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

result = ''
if 0 < a and a <= 12:
    result += 'MM'
else:
    result += 'YY'
if 0 < b and b <= 12:
    result += 'MM'
else:
    result += 'YY'

if 'MMMM' == result:
    result = 'AMBIGUOUS'
elif 'YYYY' == result:
    result = 'NA'
print(result)

Solution (Python):
S = list(input())
s1 = [S[0],S[1]]
s2 = [S[2],S[3]]
s1 = int("".join(s1))
s2 = int("".join(s2))

if s1 >0 and s1 <13 and s2>0 and s2 <13:
    print("AMBIGUOUS")

elif s2 > 0 and s2 < 13:
    print("YYMM")

elif s1 < 13 and s1 > 0:
    print("MMYY")

else:
    print("NA")