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())

FF = S[:2]
SS = S[2:]

if(int(FF)<13 and int(FF) >0):
    if(int(SS)<13 and int(SS) > 0):
        print("AMBIGUOUS")
        
    else:
        print("MMYY")
        
elif(int(SS)<13 and int(SS)>0):
    print("YYMM")
    
else:
    print("NA")

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

Solution (Python):


s = input()
front = int(s[0:2])
back = int(s[2:])

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

Solution (Python):
s = input()
mae = s[0] + s[1]
usiro = s[2] + s[3]

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

maeOK = mae in monthexe
usiroOK = usiro in monthexe

if maeOK:
  if usiroOK:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if usiroOK:
    print("YYMM")
  else:
    print("NA")

Solution (Python):
S = input()

AA = int(S[:2])
BB = int(S[2:])

if (0 < AA < 13) and (0 < BB < 13) :
    print("AMBIGUOUS")
elif 0< AA < 13:
    print("MMYY")
elif 0< BB < 13 :
    print("YYMM")
else :
    print("NA")

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

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

Solution (Python):
S = input()

AA = S[:2]
BB = S[2:]
a = []
for i in range(1, 13):
    if 1 <= i <= 9:
        a.append('0' + str(i))
    else:
        a.append(str(i))
if not AA in a and not BB in a:
    print('NA')
elif AA in a and BB in a:
    print('AMBIGUOUS')
elif AA in a:
    print('MMYY')
else:
    print('YYMM')

Solution (Python):

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

Solution (Python):
S = int(input())
a = int(S / 100)
b = S - a*100
if a <=12 and b <= 12 and a > 0 and b > 0:
    print("AMBIGUOUS")
elif a <= 12 and a > 0:
    print("MMYY")
elif b<= 12 and b > 0:
    print("YYMM")
else:
    print("NA")

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

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

def YorM(i):
  if 1 <= i and i <= 12:
    return "b"
  elif i < 1 or 12 < i:
    return "y"
  else:
    return "n"
  
isA = YorM(A)
isB = YorM(B)

if isA == "n" or isB == "n":
  print("NA")
elif isA == "b" and isB == "b":
  print("AMBIGUOUS")
elif isA == "y" and isB == "y":
    print("NA")
elif isA == "y":
  print("YYMM")
else:
  print("MMYY")

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

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

Solution (Python):


inputs = input()
AA = int(inputs[:2])
BB = int(inputs[2:])

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

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

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

Solution (Python):
S = input()

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

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

Solution (Python):
S = list(input())
head = int(S[0] + S[1])
tail = int(S[2] + S[3])
minN = min(head, tail)
maxN = max(head, tail)
if 1 <= maxN and maxN <= 12 and 1 <= minN and minN <= 12:
    print("AMBIGUOUS")
    exit()
elif (maxN <= 0 or 13 <= maxN) and (minN <= 0 or 13 <= minN):
    print("NA")
    exit()
if (head == 0 or head >= 13) and 1 <= tail and tail <= 12:
    print("YYMM")
elif 1 <= head and head <= 12 and (tail >= 13 or tail == 0):
    print("MMYY")

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):


import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())

    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    s = lines[0]

    return (s,)


def solve(s):

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

    def mm(x):
        return 1 <= x and x <= 12

    def yy(x):
        return 0 <= x and x <= 99

    result = "NA"
    if mm(a) and mm(b):
        result = "AMBIGUOUS"
    elif mm(a) and yy(b):
        result = "MMYY"
    elif yy(a) and mm(b):
        result = "YYMM"

    return result


def main():
    

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

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

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

Solution (Python):
def can_be_month(n):
    if 0 < int(n) < 13:
        return True
    return False


S = input()

if can_be_month(S[:2]) and can_be_month(S[2:]):
    print('AMBIGUOUS')
elif can_be_month(S[:2]):
    print('MMYY')
elif can_be_month(S[2:]):
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = int(input())
L = S // 100
R = S % 100
if 0 < L < 13:
  if 0 < R <13:
    print('AMBIGUOUS')
  else :
    print('MMYY')
elif 0 < R < 13:
  print('YYMM')
else:
  print('NA')

Solution (Python):
S=input()
s1=int(S[0])
s2=int(S[1])
s3=int(S[2])
s4=int(S[3])
can1=10*s1+s2
can2=10*s3+s4
count=[]
count.append(0)
count.append(0)
if(0<can2 and 13>can2):
    count[0]=1
if(0<can1 and 13>can1):
    count[1]=1
if(count[0]==1 and count[1]==1):
    print("AMBIGUOUS")
elif(count[0]==0 and count[1]==1):
    print("MMYY")
elif(count[0]==1 and count[1]==0):
    print("YYMM")
else:
    print("NA")

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

mm_list = ["01","02","03","04","05","06","07","08","09","10","11","12"]
yy_list = [str(i).rjust(2, "0") for i in range(0, 100)]

s_01 = s[0:2]
s_23 = s[2:]

if s_01 in yy_list and s_23 in mm_list and s_23 in yy_list and s_01 in mm_list:
    print("AMBIGUOUS")
elif s_01 in yy_list and s_23 in mm_list:
    print("YYMM")
elif s_23 in yy_list and s_01 in mm_list:
    print("MMYY")
else:
    print("NA")

Solution (Python):


from sys import stdin

S = stdin.readline()

YorM = int(S[:2])
MorY = int(S[2:])

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

Solution (Python):
s = input()
former = s[:2]
latter = s[2:]




def isYear(s):
    num = int(s)
    
    
    
    
    return True

def isMonth(s):
    num = int(s)
    if 0 < num < 13:
        return True
    else:
        return False

if (isYear(former) and isMonth(former) and isYear(latter) and isMonth(latter)):
    print('AMBIGUOUS')
elif (isYear(former) and isMonth(latter)):
    print('YYMM')
elif (isYear(latter) and isMonth(former)):
    print('MMYY')
else:
    print('NA')

Solution (Python):
S = input()
a = int(S[0:2])
b = int(S[2:4])

def YY(a):
    if 0 <= a < 100:
        return True
    else: return False

def MM(a):
    if 0 < a <13:
        return True
    else:
        return False

if MM(a) and YY(b):
    if YY(a) and MM(b):
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif YY(a) and MM(b):
    print('YYMM')
else:
    print('NA')

Solution (Python):
def main():
    M = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
    S = input()

    S1 = S[:2]
    S2 = S[2:4]

    if S1 in M and S2 in M:
        print('AMBIGUOUS')
    elif S1 in M:
        print('MMYY')
    elif S2 in M:
        print('YYMM')
    else:
        print('NA')


if __name__ == '__main__':
    main()

Solution (Python):
S = input()


mae = int(S[0:2])
ato = int(S[2:4])

if mae >= 1 and mae <=12 and ato >= 1 and ato <= 12:
    print("AMBIGUOUS")
elif mae >= 0 and ato >= 1 and ato <=12:
    print("YYMM")
elif mae >= 1 and mae <=12  and ato >= 0:
    print("MMYY")
else:
    print("NA")

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

if 0 < f and f < 13:
    if 0 < b and b < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < b and b < 13:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
s=list(map(int,list(input())))
first=s[0]*10+s[1]
second=s[2]*10+s[3]
flag_YYMM=False
flag_MMYY=False
if first<=12 and first>=1:
  flag_MMYY=True
if second<=12 and second>=1:
  flag_YYMM=True

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

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

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

Solution (Python):
s = input()
def YY(s):
    if 0<= int(s) <= 99:
        return True
    return False

def MM(s):
    if 1<=int(s)<=12:
        return True
    return False

if YY(s[:2]) and MM(s[2:]) and MM(s[:2]) and YY(s[2:]):
        print("AMBIGUOUS")

elif YY(s[:2]) and MM(s[2:]):
     print("YYMM")
        
elif MM(s[:2])  and YY(s[2:]):
    print("MMYY")
        
else:
    print("NA")

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

    Y = int(''.join(S[:2]))
    M = int(''.join(S[2:]))


    if Y == 0 or Y > 12:
        if M == 0 or M > 12:
            print("NA")
        else:
            print("YYMM")
    else:
        if M == 0 or M > 12:
            print("MMYY")
        else:
            print("AMBIGUOUS")

            

if __name__=='__main__':
    main()

Solution (Python):
string = input()

moji_list = [0 for _ in range(4)]
for i in range(4):
    moji_list[i] = string[i]

ue = ''
sita = ''
for j in range(2):
    ue += moji_list[j]
    sita += moji_list[j+2]

int_ue = int(ue)
int_sita = int(sita)

sw_ue = 0
sw_sita = 0
if 1<=int_ue and int_ue<=12:
    sw_ue += 1

if 1<=int_sita and int_sita<=12:
    sw_sita += 1

if sw_ue == 1 and sw_sita == 1:
    print('AMBIGUOUS')
elif sw_ue == 1 and sw_sita == 0:
    print('MMYY')
elif sw_ue == 0 and sw_sita == 1:
    print('YYMM')
elif sw_ue == 0 and sw_sita == 0:
    print('NA')

Solution (Python):
S=input()


head = S[0:2]
tail = S[2:4]
head_mm = head >= "01" and head <= "12"
tail_mm = tail >= "01" and tail <= "12"
if(head_mm and tail_mm):
    ret = "AMBIGUOUS"
elif(head_mm):
    ret = "MMYY"
elif(tail_mm):
    ret = "YYMM"
else:
    ret = "NA"
print(ret)

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

def y(x):
    return 0<=x<=99
def m(x):
    return 0<x<=12

if 12<a and 12<b:
    print("NA")
elif a==0 and b==0:
    print("NA")
elif (12<a and b==0) or (a==0 and 12<b):
    print("NA")
elif m(a) and m(b):
    print("AMBIGUOUS")
elif y(a) and m(b):
    print("YYMM")
elif m(a) and y(b):
    print("MMYY")

Solution (Python):
inp = input()
s = [int(inp[0]), int(inp[1]), int(inp[2]), int(inp[3])]


f2 = s[0]*10+s[1]
l2 = s[2]*10+s[3]

flag1 = False
flag2 = False
if 1 <= f2 and f2 <= 12:
    flag2 = True
if 1 <= l2 and l2 <= 12:
    flag1 = True

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

Solution (Python):
S = input()
A = S[:2]
B = S[2:]
X = ['01','02','03','04','05','06','07','08','09','10','11','12']

if (A not in X) and (B not in X):
  print('NA')
elif A in X and B in X:
  print('AMBIGUOUS')
elif A in X:
  print('MMYY')
else:
  print('YYMM')

Solution (Python):
import sys
input = sys.stdin.readline

S = list(input())
S.pop(-1)

Month_first_flag = 1
Month_next_flag = 1

if S[0] != '0' and S[0] != '1':
    Month_first_flag = 0

if S[0] == '0':
    if S[1] == '0':
        Month_first_flag = 0

if S[0] == '1':
    if S[1] != '0' and S[1] != '1' and S[1] != '2':
        Month_first_flag = 0

if S[2] != '0' and S[2] != '1':
    Month_next_flag = 0

if S[2] == '0':
    if S[3] == '0':
        Month_next_flag = 0

if S[2] == '1':
    if S[3] != '0' and S[3] != '1' and S[3] != '2':
        Month_next_flag = 0

if Month_first_flag == 1 and Month_next_flag == 1:
    print("AMBIGUOUS")
    sys.exit(0)
if Month_first_flag == 1 and Month_next_flag == 0:
    print("MMYY")
    sys.exit(0)
if Month_first_flag == 0 and Month_next_flag == 1:
    print("YYMM")
    sys.exit(0)
else:
    print("NA")

Solution (Python):
s = input()
A = int(s[:2])
B = int(s[2:])
lis = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
if A in lis:
	a = 1
else:
	a = 2
if B in lis:
	b = 1
else:
	b = 2
if a == 1 and b == 1:
	print("AMBIGUOUS")
elif a == 1 and b == 2:
	print("MMYY")
elif a == 2 and b == 1:
	print("YYMM")
else:
	print("NA")

Solution (Python):
s = input()

ff = int(s[:2])
bb = int(s[2:])

if (ff>=1 and ff<=12) and (bb>=1 and bb<=12):
    print("AMBIGUOUS")
elif (ff>=1 and ff<=12):
    print("MMYY")
elif (bb>=1 and bb<=12):
    print("YYMM")
else:
    print("NA")

Solution (Python):
s = input()

first = int(s[:2])
second = int(s[2:])

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

Solution (Python):

S = str(input())

s0 = int(S[0:2])
s1 = int(S[2:])

if s0>12 or s0==0:
    if s1>12 or s1==0:
        ans="NA"
    else:
        ans="YYMM"
elif s1>12 or s1==0:
    ans="MMYY"
else:
    ans="AMBIGUOUS"
    
print(ans)

Solution (Python):








S=input()
ant=S[:2]
post=S[2:]
flag=0
m=["01","02","03","04","05","06","07","08","09","10","11","12"]
ans="NA"
if ant in m:
    ans="MMYY"
    flag=1
if post in m:
    if flag==1:
        ans="AMBIGUOUS"
    else:
        ans="YYMM"



print(ans)

Solution (Python):
def isMonth(n):
    return 1 <= n and n <= 12

def isYear(n):
    return True

s = input()
x = int(s[0:2])
y = int(s[2:4])

yymm = isYear(x) and isMonth(y)
mmyy = isMonth(x) and isYear(y)

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

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

front_num = S // 100
back_num = S % 100

if 0 < front_num <= 12 and 0 < back_num <= 12:   
    print("AMBIGUOUS")
elif 0 < front_num <= 12:
    print("MMYY")
elif 0 < back_num <= 12:
    print("YYMM")
else:
    print("NA")

Solution (Python):

import time
import os
import time
import re
s=input()
left=s[0:2]
right=s[2:4]
if left[0]==0:
    left=left[1]
if right[0]==0:
    right=right[1]
left=int(left)
right=int(right)
bo=[False for a in range(2)]


if right>0 and right<13:
    bo[0]=True

if left>0 and left<13:
    bo[1]=True

if bo[0]==True and bo[1]==True:
    print("AMBIGUOUS")
elif bo[0]==False and bo[1]==False:
    print("NA")
elif bo[0]==True and bo[1]==False:
    print("YYMM")
else:
    print("MMYY")

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

Solution (Python):

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

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

Solution (Python):
def main():
	s = input()
	aa = int(s[:2])
	bb = int(s[2:])
	ans = ""
	if (aa <= 12) and (aa > 0):
		if (bb <= 12) and (bb > 0):
			ans = "AMBIGUOUS"
		else:
			ans = "MMYY"
	else:
		if (bb <= 12) and (bb > 0):
			ans = "YYMM"
		else:
			ans = "NA"
	print(ans)

main()

Solution (Python):
n = input()
ue = int(n[:2])
shita = int(n[2:])

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

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

up = int(X/100)
dn = int(X%100)

up_month = False
dn_manth = False

if up >= 1 and up <= 12:
    up_month = True

if dn >= 1 and dn <= 12:
    dn_month = True
else:
    dn_month = False
    

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

Solution (Python):
S = input()
a = int(S[0]+S[1])
b = int(S[2]+S[3])
isyymm = 0
ismmyy = 0
if a>=0 and b>=0:
    if a<=12 and a>0:
        ismmyy = 1
    if b<=12 and b>0:
        isyymm = 1

ans = ['NA','YYMM','MMYY','AMBIGUOUS']
print(ans[isyymm+ismmyy*2])

Solution (Python):
import sys

def solve(S):
    f = int(S[0:2])
    s = int(S[2:4])
    f_flag = False
    if 1 <= f <= 12:
        f_flag = True

    s_flag = False
    if 1 <= s <= 12:
        s_flag = True

    if f_flag and s_flag:
        return 'AMBIGUOUS'
    elif f_flag:
        return 'MMYY'
    elif s_flag:
        return 'YYMM'
    else:
        return 'NA'

if __name__ == '__main__':

    S = sys.stdin.readline().strip()
    print solve(S)

Solution (Python):
import datetime

S=input()

YYMM_OK = True
try:
	datetime.datetime.strptime("20" + S, "%Y%m")
except ValueError:
	YYMM_OK = False

MMYY_OK = True
try:
	mmyy=S[:2] + "20"+S[2:]
	
	datetime.datetime.strptime(mmyy, "%m%Y")
except ValueError:
	MMYY_OK = False

ans ="NA"
if YYMM_OK and MMYY_OK:
	ans = "AMBIGUOUS"
elif YYMM_OK:
	ans = "YYMM"
elif MMYY_OK:
	ans = "MMYY"

print(ans)

Solution (Python):
s = input()


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

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

Solution (Python):
S = input()

S1 = S[0:2]
S2 = S[2:4]

def is_MM(s):
  if 1 <= int(s) <= 12:
    return(True)
  else:
    return(False)

def is_YY(s):
  if 0 <= int(s) <= 99:
    return(True)
  else:
    return(False)

if (not is_MM(S1) and not is_MM(S2)) or (not is_YY(S1) and not is_YY(S2)):
  print("NA")
elif is_YY(S1) and is_MM(S1) and is_YY(S2) and is_MM(S2):
  print("AMBIGUOUS")
elif is_YY(S1) and is_MM(S2):
  print("YYMM")
elif is_YY(S2) and is_MM(S1):
  print("MMYY")

Solution (Python):
S = input()
X = list(S)
Y = [int(X[i]) for i in range(4)]
a = 10 * Y[0] + Y[1]
b = 10 * Y[2] + Y[3]
if a >= 13 or a == 0:
    if b >= 13 or b == 0:
        print('NA')
    else:
        print('YYMM')
else:
    if b >= 13 or b == 0:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Solution (Python):
S = input()
S_1 = int(S[:2])
S_2 = int(S[2:])

YM_Flag = False
MY_Flag = False

if S_1 >= 1 and S_1 <= 12:
    MY_Flag = True

if S_2 >= 1 and S_2 <= 12:
    YM_Flag = True

if MY_Flag and YM_Flag:
    print('AMBIGUOUS')
elif MY_Flag:
    print('MMYY')
elif YM_Flag:
    print('YYMM')
else:
    print('NA')

Solution (Python):

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

if 12>=f>=1 and 12>=l>=1:
    k=3
elif not(12>=f>=1) and 12>=l>=1:
    k=1
elif not(12>=l>=1) and 12>=f>=1:
    k=2
else:
    k=4
ans=['','YYMM','MMYY','AMBIGUOUS','NA']
print(ans[k])

Solution (Python):



S = list(input())
a = int(S[0]+S[1])
b = int(S[2]+S[3])

if a >= 13 and b >= 13:
    print('NA')
elif a == 0 and b == 0:
    print('NA')
elif a == 0 and b >= 13:
    print('NA')
elif a == 0:
    print('YYMM')
elif b == 0 and a >= 13:
    print('NA')
elif b == 0:
    print('MMYY')
elif a >= 13:
    print('YYMM')
elif b >=13:
    print('MMYY')
else:
    print('AMBIGUOUS')

Solution (Python):
s = input()

mae = int(s[0] + s[1])
ushiro = int(s[2] + s[3])

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

Solution (Python):
S = input()
first, last = int(S[:2]), int(S[2:])
yymm = (0 <= first <= 99) and (1 <= last <= 12)
mmyy = (1 <= first <= 12) and (0 <= first <= 99)
if yymm and mmyy:
    print('AMBIGUOUS')
elif yymm:
    print('YYMM')
elif mmyy:
    print('MMYY')
else:
    print('NA')

Solution (Python):
S = input()

s = list(S)
num = []
for k in s:
    num.append(int(k))

num1 = 10*num[0] + num[1]

num2 = 10*num[2] + num[3]

ans1 = False
ans2 = False
if num1 < 13 and num1 >0:
    ans1 = True

if num2 < 13 and num2 >0:
    ans2 = True

if ans1 and ans2:
    print("AMBIGUOUS")
elif ans1 and not ans2:
    print("MMYY")
elif not ans1 and ans2:
    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):

from collections import defaultdict

def get_renzokuomote(goal, now_num):
    count = 0
    while now_num < goal:
        now_num *= 2
        count += 1
    return count



def main():
    num = int(input())
    a = num // 100
    b = num % 100

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






if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
f1 = 0
f2 = 0
if int(s[0]) >=2:
    f1 =1
if int(s[0]) ==1 and int(s[1]) >= 3:
    f1 = 1
if int(s[0]) ==0 and int(s[1]) ==0:
    f1 =1

if int(s[2]) >=2:
    f2 =1
if int(s[2]) ==1 and int(s[2]) >= 3:
    f2 = 1
if int(s[2]) ==0 and int(s[3]) ==0:
    f2 =1

if (f1+f2) ==1:
    if f1 ==1:
        s = "YYMM"
    else:
        s = "MMYY"
else:
    if (f1+f2) ==2:
        s = "NA"
    else:
        s = "AMBIGUOUS"
print(s)

Solution (Python):


from sys import stdin

def calc(s):

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

    if 0 < a and a <= 12:
        a = 1
    elif 0 <= a and a <= 99:
        a = 2
    else:
        a = 3

    if 0 < b and b <= 12:
        b = 1
    elif 0 <= b and b <= 99:
        b = 2
    else:
        b = 3

    if a == 1 and b == 1:
        ans = 'AMBIGUOUS'
    elif a == 1 and b == 2:
        ans = 'MMYY'
    elif a == 2 and b == 1:
        ans = 'YYMM'
    else:
        ans = 'NA'

    return ans

def main():
    s = stdin.readline().rstrip()
    ans = calc(s)
    print(ans)
    
if __name__=='__main__':
    main()

Solution (Python):
s = input()

fst = int(s[0:2])
snd = int(s[2:4])

if fst > 0 and fst <= 12:
    
    if snd > 0 and snd <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    
    if snd > 0 and snd <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
from datetime import datetime

S = input()
former = int(S[:2])
latter = int(S[2:])
YYMM = False
MMYY = False

try:
    datetime(former + 2000, latter, 1)
    YYMM = True
except:
    pass

try:
    datetime(latter + 2000, former, 1)
    MMYY = True
except:
    pass

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

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

Solution (Python):
S = input()

head = int(S[:2])
tail = int(S[2:])

if 1 <= head <= 12:
    if 1 <= tail <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= tail <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
def is_m(n):
    return 1 <= n & n <= 12


s=input()
h=int(s[0:2])
t=int(s[2:4])

if is_m(h) & is_m(t):
    print('AMBIGUOUS')
elif is_m(h):
    print('MMYY')
elif is_m(t):
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
import os, sys, re, math

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

def isMM(n):
    if n >= 1 and n <= 12:
        return True
    else:
        return False

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

Solution (Python):
def check(M_1, M_2):
    M_1 = int(M_1)
    M_2 = int(M_2)
    MM = M_1 * 10 + M_2
    if 1 <= MM <= 12:
        return True
    else:
        return False


S = input()
ans = [0, 0]
if check(S[0], S[1]):
    ans[0] += 1
if check(S[2], S[3]):
    ans[1] += 1

if ans == [0, 0]:
    print("NA")
elif ans == [0, 1]:
    print("YYMM")
elif ans == [1, 0]:
    print("MMYY")
elif ans == [1, 1]:
    print("AMBIGUOUS")

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

for i in range(len(S)):
    S[i] = int(S[i])
    
mae = S[0]*10 + S[1]
ato = S[2]*10 + S[3]

if (1 <= mae <= 12) and (1 <= ato <= 12):
    print('AMBIGUOUS')

elif (1 <= mae <= 12) and (ato < 1 or 12 < ato):
    print('MMYY')
    
elif (mae < 1 or 12 < mae) and (1<= ato <= 12):
    print('YYMM')

else:
    print('NA')

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):
s = input()
a = s[0:2]
b = s[2:4]
month = ["0"+str(i) for i in range(1,10)]+["10","11","12"]

if a in month and b in month: ans = "AMBIGUOUS"
elif a in month: ans = "MMYY"
elif b in month: ans = "YYMM"
else: ans = "NA"

print(ans)

Solution (Python):
s = input()

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

a_flag = False
b_flag = False

if a > 0 and a <= 12:
    a_flag = True

if b > 0 and b <= 12:
    b_flag = True


if a_flag and b_flag:
    print('AMBIGUOUS')
elif a_flag:
    print('MMYY')
elif b_flag:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = int(input())  
AB = S // 100
CD = S-AB*100
if AB == 0 or CD == 0:
    if 1 <= AB <= 12:
        print("MMYY")
    elif 1 <= CD <= 12:
        print("YYMM")
    else:
        print("NA")

elif 13 <= AB and 13 <= CD:
    print("NA")
elif AB <= 12 and CD <= 12:
    print("AMBIGUOUS")
elif 13 <= AB:
    print("YYMM")
else:
    print("MMYY")

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

first_half = int(S[0:2])
second_half = int(S[2:4])

a = 0
if 0 < first_half < 13:
    a = 1

b = 0
if 0 < second_half < 13:
    b = 1

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

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

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

Solution (Python):
s=input()

def f(a):
    a=int(a)
    if a>0 and a<=12:
        return 0
    elif a>12 or a==0:
        return 1


if f(s[0:2])*f(s[2:4])==0:
    if f(s[0:2])==0 and f(s[2:4])==0:
        print("AMBIGUOUS")
    elif f(s[0:2])==1 and f(s[2:4])==0:
        print("YYMM")
    elif f(s[0:2])==0 and f(s[2:4])==1:
        print("MMYY")
else:
    print("NA")

Solution (Python):



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

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