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

first = s[:2]
second = s[2:]

if int(first) <= 12 and int(first) > 0:
    first_m = True
else:
    first_m = False
if int(second) <= 12 and int(second) > 0:
    second_m = True
else:
    second_m = False

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

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=input()
a=int(s[:2])
b=int(s[2:])
if 1<= a <= 12 and 1<= b <= 12:
	print('AMBIGUOUS')
elif 1 <= a <= 12 and (b==0 or 13 <= b):
	print('MMYY')
elif 1 <= b <= 12 and (a==0 or 13 <= a):
	print('YYMM')
else:
	print('NA')

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

    s1 = s // 100
    s2 = s - s1 * 100

    if s1 == 0:
        s1 = 13
    if s2 == 0:
        s2 = 13

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

if __name__ == '__main__':
    main()

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

Solution (Python):
def month(num):
    if 0 < num <= 12:
        return True
    else:
        return False


S = input()
first = int(S[:2])
second = int(S[2:])

if month(first):
    if month(second):
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif not month(first) and month(second):
    print('YYMM')

else:
    print('NA')

Solution (Python):
def month(num):
    if 0 < num <= 12:
        return 1
    else:
        return 0


S = input()
first = int(S[:2])
second = int(S[2:])

if month(first) == 1 and month(second) == 1:
    print('AMBIGUOUS')

elif month(first) == 1 and month(second) == 0:
    print('MMYY')

elif month(first) == 0 and month(second) == 1:
    print('YYMM')

else:
    print('NA')

Solution (Python):
def month(n):
    if 0 < n and n < 13:
        return True
    else:
        return False


num = input()
if month(int(num[2:])):
    if month(int(num[:2])):
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if month(int(num[:2])):
        print('MMYY')
    else:
        print('NA')

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

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

if 0 < left <= 12:
    if 0 < right <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < right <= 12:
        print('YYMM')
    else:
        print('NA')

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

Solution (Python):
def is_month(t):
    return 1 <= int(t) <= 12

s = input()
pre, suf = s[:2], s[2:]

if is_month(pre) and is_month(suf):
    print('AMBIGUOUS')
elif not is_month(pre) and not is_month(suf):
    print('NA')
elif is_month(pre) and not is_month(suf):
    print('MMYY')
else:
    print('YYMM')

Solution (Python):
s = input()

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

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




if (1 <= int(S[:2]) <= 12) & (1 <= int(S[2:]) <= 12):
    print('AMBIGUOUS')
elif (1 <= int(S[:2]) <= 12) & ((int(S[2:]) == 0) or (13 <= int(S[2:]))):
    print('MMYY')
elif (1 <= int(S[2:]) <= 12) & ((int(S[:2]) == 0) or (13 <= int(S[:2]))):
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input()

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

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

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

Solution (Python):
S = int(input())
x = S//100
y = S%100
yymm = (1<=y<=12)
mmyy = (1<=x<=12)

ans = "NA"
if yymm and mmyy:
    ans = 'AMBIGUOUS'
elif yymm and not(mmyy):
    ans = 'YYMM'
elif mmyy and not(yymm):
    ans = 'MMYY'

print(ans)

Solution (Python):
s = input()

left = int(s[:2])
right = int(s[2:])

if 0 < left <= 12 and 0 < right <= 12:
    print('AMBIGUOUS')
elif 0 < left <= 12 < right or right == 0 < left <= 12:
    print('MMYY')
elif 0 < right <= 12 < left or left == 0 < right <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = list(map(str,input()))

s1 = s[:2]
s2 = s[2:4]

s1 = int("".join(s1))
s2 = int("".join(s2))
yy =0
mm=0


if 0<= s1 <=99 and 1<= s2 <= 12:
  yy +=1

if 0<= s2 <=99 and 1<= s1 <= 12:
  mm +=1
  
if yy ==1 and mm ==1:
  print("AMBIGUOUS")
elif yy==1:
  print("YYMM")
elif mm==1:
  print("MMYY")
else:
  print("NA")

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

Solution (Python):
def YY_or_MM(K):
    if 0<K<13:
        return "MM"
    else:
        return "YY"
S=str(input())
head=int(S[0:2])
tail=int(S[2:])
ans=YY_or_MM(head)+YY_or_MM(tail)
if ans=="YYYY":
    print("NA")
elif ans=="MMMM":
    print("AMBIGUOUS")
else:print(ans)

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

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

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

Solution (Python):
S1, S2, S3, S4 = input()
Front = 10 * int(S1) + int(S2)
Back  = 10 * int(S3) + int(S4)

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

Solution (Python):
S1, S2, S3, S4 = input()
Front = 10 * int(S1) + int(S2)
Back  = 10 * int(S3) + int(S4)

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

Solution (Python):
def resolve():
    import sys
    import os
    input = sys.stdin.readline
    
    S = input().rstrip(os.linesep)
    pre = S[:2]
    suf = S[2:]

    def can_MM(string):
        if int(string) <= 12 and int(string) >= 1: 
            return True
        else:
            return False

    pre_mm = can_MM(pre)
    suf_mm = can_MM(suf)

    if pre_mm:
        if suf_mm:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if suf_mm:
            print("YYMM")
        else:
            print("NA")
    

if __name__ == "__main__":
    resolve()

Solution (Python):
def resolve():
    import sys
    import os
    input = sys.stdin.readline
    
    S = input().rstrip(os.linesep)
    pre = S[:2]
    suf = S[2:]

    def can_MM(string):
        if int(string) <= 12 and int(string) >= 1: 
            return True
        else:
            return False

    pre_mm = can_MM(pre)
    suf_mm = can_MM(suf)

    if pre_mm:
        if suf_mm:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if suf_mm:
            print("YYMM")
        else:
            print("NA")
    

if __name__ == "__main__":
    resolve()

Solution (Python):
def resolve():
    import sys
    import os
    input = sys.stdin.readline
    
    S = input().rstrip(os.linesep)
    pre = S[:2]
    suf = S[2:]

    def can_MM(string):
        if int(string) <= 12 and int(string) >= 1: 
            return True
        else:
            return False

    pre_mm = can_MM(pre)
    suf_mm = can_MM(suf)

    if pre_mm:
        if suf_mm:
            print("AMBIGUOUS")
            return
        else:
            print("MMYY")
            return
    else:
        if suf_mm:
            print("YYMM")
            return
        else:
            print("NA")
            return
    

if __name__ == "__main__":
    resolve()

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(S: str):
    u = int(S[:2])
    d = int(S[2:])
    
    if 0 < u <= 12 and 0 < d <= 12:
        print('AMBIGUOUS')
    
    elif 0 < d <= 12:
        print('YYMM')

    elif 0 < u <= 12:
        print('MMYY')
        
    else:
        print('NA')
        
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  
    solve(S)

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

ans = [0, 0]
for i in range(100):
    for j in range(1, 13):
        if str(i).zfill(2) + str(j).zfill(2) == s:
            ans[0] = 1
        if str(j).zfill(2) + str(i).zfill(2) == s:
            ans[1] = 1

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

Solution (Python):
N = input()
count = 0
MM = [i+1 for i in range(12)]
if int(N[:2]) in MM:
    count += 1
if int(N[2:]) in MM:
    count += 2
if count == 1:
    print('MMYY')
elif count == 2:
    print('YYMM')
elif count == 3:
    print('AMBIGUOUS')
else:
    print('NA')

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

Solution (Python):

def change(x):
    if 1<=x<=12:
        return 0
    else:
        return 1
ans=["AMBIGUOUS","NA","MMYY","YYMM"]
s=input()
a=change(int(s[:2]))
b=change(int(s[2:]))
if a==b:
    print(ans[a])
else:
    print(ans[a+2])

Solution (Python):
S=input()
forward=""
back=""
yymm=0
mmyy=0
for i in range(4):
    forward=S[:2]
    back=S[2:]
forward=int(forward)
back=int(back)
if ((1<=forward)and(forward<=12)):
    mmyy=1
if ((1<=back)and(back<=12)):
    yymm=1
if (mmyy==1):
    if (yymm==1):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(yymm==1):
        print("YYMM")
    else:
        print("NA")

Solution (Python):
import sys

s = sys.stdin.readline().rstrip()

def main():
    a, b = int(s[:2]), int(s[2:])
    if 1 <= a <= 12:
        if 1 <= b <= 12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1 <= b <= 12:
            return 'YYMM'
        else:
            return 'NA'

if __name__ == '__main__':
    ans = main()
    print(ans)

Solution (Python):
s = input()

former = int(s[:2])
later = int(s[2:])


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

Solution (Python):
S = str(input())
S1 = list(S)
S2 = (10*int(S[0])+int(S[1]),10*int(S[2])+int(S[3]))
if 0 < S2[0] <= 12:
    if 0 < S2[1] <= 12:
        print('AMBIGUOUS')
    elif S2[1] == 0 or S2[1] > 12:
        print('MMYY')
elif S2[0] == 0 or S2[0] > 12:
    if 0 < S2[1] <= 12:
        print('YYMM')
    elif S2[1] == 0 or S2[1] > 12:
        print('NA')

Solution (Python):
def YorM(x):                                                                                                                                                        
        
        
    if((1<=x)and(x<=12)):                                                                                                                                           
        return 1                                                                                                                                                    
    else:                                                                                                                                                           
        return 0                                                                                                                                                    
                                                                                                                                                                    
def D(a,b):                                                                                                                                                         
    n1 = YorM(a)                                                                                                                                                    
    n2 = YorM(b)                                                                                                                                                    
    
    if(n1==0 and n2==0):                                                                                                                                            
        print("NA")                                                                                                                                                 
    elif(n1==0 and n2==1):                                                                                                                                          
        print("YYMM")                                                                                                                                               
    elif(n1==1 and n2==0):                                                                                                                                          
        print("MMYY")                                                                                                                                               
    else:                                                                                                                                                           
        print("AMBIGUOUS")                                                                                                                                          
                                                                                                                                                                    
                                                                                                                                                                    
S = input()                                                                                                                                                         
a = int(S[0:2])                                                                                                                                                     
b = int(S[2:4])                                                                                                                                                     
D(a, b)

Solution (Python):
S = input()

l = S[:2]
r = S[2:]

def isMonth(num):
  if 1 <= int(num) <= 12:
    return True
  else:
    return False
  
if isMonth(l) and isMonth(r):
  print("AMBIGUOUS")
elif isMonth(l):
  print("MMYY")
elif isMonth(r):
  print("YYMM")
else:
  print("NA")

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

S_pre = S // 100
S_nex = S - S_pre * 100

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

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

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

Solution (Python):
s = input()
s1 = int(s[0:2])
s2 = int(s[2:4])
ans = [False, False]
if 1 <= s2 <= 12:
    ans[0] = True
if 1 <= s1 <= 12:
    ans[1] = True
if ans == [False, False]:
    print("NA")
elif ans == [True, True]:
    print("AMBIGUOUS")
elif ans == [True, False]:
    print("YYMM")
elif ans == [False, True]:
    print("MMYY")

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

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

Solution (Python):
S = input()

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

Solution (Python):
def isMonth(x):
  y = int(x)
  return (1 <= y and y <= 12)

date = input()
firstvalid = isMonth(date[0:2])
secondvalid = isMonth(date[2:])
 
if firstvalid and secondvalid:
  print('AMBIGUOUS')
elif firstvalid:
  print('MMYY')
elif secondvalid:
  print('YYMM')
else:
  print('NA')

Solution (Python):
import sys

stdin = sys.stdin

mod = 1000000007
inf = 1 << 60

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

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

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

Solution (Python):
from sys import stdin
S = stdin.readline().rstrip()
front = int(S[:2])
back = int(S[2:])
def bool_mm(input):
    if 0 < input <= 12:
        return True
    else:
        return False 
bool_f = bool_mm(front)
bool_b = bool_mm(back)
if bool_f and bool_b:
    print("AMBIGUOUS")
elif bool_f and ~bool_b:
    print("MMYY")
elif ~bool_f and bool_b:
    print("YYMM")
else:
    print("NA")

Solution (Python):
import sys
s = input()
mm1 = False
mm2 = False

if 0 < int(s[:2]) < 13:
    mm1 = True
if 0 < int(s[-2:]) < 13:
    mm2 = True

if mm1 == True and mm2 == True:
    print("AMBIGUOUS")
    sys.exit()
if mm1 == False and mm2 == False:
    print("NA")
    sys.exit()
if mm1 == True and mm2 == False:
    print("MMYY")
    sys.exit()
if mm1 == False and mm2 == True:
    print("YYMM")
    sys.exit()
print("NA")

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

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

S = input()

s1 = int(S[:2])
s2 = int(S[2:])
mr = range(1, 13)

if s1 in mr and s2 in mr:
    print('AMBIGUOUS')
elif s1 in mr:
    print('MMYY')
elif s2 in mr:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input()
s1 = int(S[:2])
s2 = int(S[2:])
def is_MM(s):
    return 1 <= s <= 12

if is_MM(s1) and is_MM(s2):
    print('AMBIGUOUS')
elif is_MM(s1):
    print('MMYY')
elif is_MM(s2):
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()
h = s[:2]
t = s[2:]
def montheable(p):
    return '00' < p < '13'
if montheable(h) and montheable(t):
    print('AMBIGUOUS')
elif montheable(h):
    print('MMYY')
elif montheable(t):
    print('YYMM')
else:
    print('NA')

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

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

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

Solution (Python):
s=int(input())
s1=s/100
s2=s%100
if((1<=s1<=12)and(1<=s2<=12)):
    print('AMBIGUOUS')
elif(((s1<1) or (12<s1)) and(1<=s2<=12)):
    print('YYMM')
elif(((s2<1) or (12<s2)) and(1<=s1<=12)):
    print('MMYY')
else:
    print('NA')

Solution (Python):
s = input()

l = 0<int(s[:2])<13
r = 0<int(s[2:])<13

if l == 1:
  print('AMBIGUOUS' if r == 1 else 'MMYY')
else:
  print('YYMM' if r == 1 else 'NA')

Solution (Python):
def main():
    S = input()
    first = int(S[0:2])
    last = int(S[2:4])

    if((first>12 or first==0) and last<=12 and last>=1):
        print("YYMM")
    elif((last>12 or last==0) and first<=12 and first>=1):
        print("MMYY")
    elif(last<=12 and first<=12 and last>=1 and first>=1):
        print("AMBIGUOUS")
    else:
        print("NA")
    
    return
main()

Solution (Python):
def yymm(x,y):
    if 1<=y and y<=12:
        return True
    else:
        return False

S = input()

x = int(S[:len(S)//2])
y = int(S[len(S)//2:])

if yymm(x,y) and yymm(y,x):
    print("AMBIGUOUS")
elif yymm(x,y):
    print("YYMM")
elif yymm(y,x):
    print("MMYY")
else:
    print("NA")

Solution (Python):
S = input()
s1,s2 = int(S[0:2]),int(S[2:4])

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

if f(s1) and f(s2):
  print("AMBIGUOUS")
elif f(s1) and (s2 > 12 or s2 ==0):
  print("MMYY")
elif f(s2) and (s1 > 12 or s1 ==0):
  print("YYMM")
else:
  print("NA")

Solution (Python):
S = list(input())
Y = S[0] + S[1]
M = S[2] + S[3]
if 1 <= int(M) and int(M) <= 12:
    if 1 <= int(Y) and int(Y) <= 12:
        print("AMBIGUOUS")

    elif int(Y) == 0 or int(Y) > 12:
        print("YYMM")

    else:
        pass
    
elif 1 <= int(Y) and int(Y) <= 12:
    print("MMYY")

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 <= a <= 12:
    print("MMYY")
elif 1 <= b <= 12:
    print("YYMM")
else:
    print("NA")

Solution (Python):
S=input()
a=int(S[:2])
b=int(S[2:])
ans=0
lab=["NA","MMYY","YYMM","AMBIGUOUS"]

if a>=1 and a<=12:
    ans+=1
    
if b>=1 and b<=12:
    ans+=2
    
print(lab[ans])

Solution (Python):
dList = list(str(input()))

former = int(''.join([dList[0],dList[1]]))
latter = int(''.join([dList[2],dList[3]]))

if 1 <= former <= 12: 
  if 1<= latter<= 12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif former > 12:
  if 1<= latter<= 12:
    print("YYMM")
  else:
    print("NA")
else:
  if latter == 0 or latter > 13:
    print("NA")
  else:
    print("YYMM")

Solution (Python):




















def isMonth(x):
    num = int(x)
    return (1 <= num and num <= 12)

def isYear(x):
    num = int(x)
    return (0 <= num and num <= 99)

def isYYMM(head, tail):
    return (isYear(head) and isMonth(tail))

def isMMYY(head, tail):
    return (isMonth(head) and isYear(tail))

S = input()
head = S[0:2]
tail = S[2:4]

if (isYYMM(head, tail) and isMMYY(head, tail)):
    res = 'AMBIGUOUS'
elif isYYMM(head, tail):
    res = 'YYMM'
elif isMMYY(head, tail):
    res = 'MMYY'
else:
    res = 'NA'

print(res)

Solution (Python):
S = input()

S1 = int(S[0]+S[1])
S2 = int(S[2]+S[3])

flag = 0
S1_flag = 0
 
if S1 >= 1 and S1 <= 12:
    flag = flag +1
    S1_flag = 1    
if S2 >= 1 and S2 <= 12:
    flag = flag +1
    
if flag == 0:
    print('NA')
elif flag == 2:
    print('AMBIGUOUS')
elif S1_flag == 1:
    print('MMYY')
else:
    print('YYMM')

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(input())
a = int(s[0] + s[1])
b = int(s[2] + s[3])

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

Solution (Python):
n = input()
a = int(n[0]+n[1])
b = int(n[2]+n[3])

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):
n = list(input())
a=int(n[0]+n[1]) 
b=int(n[2]+n[3]) 

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

Solution (Python):
import math
import sys
import numpy as np

def int_input():
    return map(int, input().split())

s = input()

flag = 0
if 1 <= int(s[:2]) <= 12: flag += 2
if 1 <= int(s[2:]) <= 12: flag += 1

ans = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(ans[flag])

Solution (Python):
S = input()




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

A = ""
B = ""
ans = ""
if AA == 0 or AA > 12:
    A = "YY"
else:
    A = "MM"
    
if BB == 0 or BB > 12:
    B = "YY"
else:
    B = "MM"
    
if A == "YY" and  B == "YY":
    ans = "NA"
elif A == "YY" and B == "MM":
    ans = "YYMM"
elif A == "MM" and B == "YY":
    ans = "MMYY"
else:
    ans = "AMBIGUOUS"
        
print(ans)

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

a = int(s[0]+s[1])
b = int(s[2]+s[3])

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()
first_half = int(S[:2])
second_half = int(S[2:])
is_month = lambda x: 1 <= x and x <= 12

if is_month(first_half) and is_month(second_half):
    print('AMBIGUOUS')
elif is_month(first_half) and not is_month(second_half):
    print('MMYY')
elif not is_month(first_half) and is_month(second_half):
    print('YYMM')
else:
    print('NA')

Solution (Python):
import sys
def input(): return sys.stdin.readline().rstrip()

def is_month(n):
    return 1 <= n <= 12

def main():
    s = input()
    s1 = int(s[:2])
    s2 = int(s[2:])

    if is_month(s1) and is_month(s2):
        print('AMBIGUOUS')
    elif is_month(s1):
        print('MMYY')
    elif is_month(s2):
        print('YYMM')
    else:
        print('NA')

if __name__ == '__main__':
    main()

Solution (Python):
s = input()

YYMM=False
MMYY=False

if 1 <= int(s[:2]) <= 12:
  MMYY=True
if 1 <= int(s[2:]) <= 12:
  YYMM=True

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

Solution (Python):
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

S = int(readline())
S1, S2 = divmod(S, 100)

if 12 >= S1 > 0:
    if 12 >= S2 > 0:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if 12 >= S2 > 0:
        ans = 'YYMM'
    else:
        ans = 'NA'

print(ans)

Solution (Python):

s=input()
a=[int(s[:2]), int(s[2:])]
mmyy=False
yymm=False
if (1 <= a[0] <= 12) & (0 <= a[1] <= 99):
  mmyy = True

if (0 <= a[0] <= 99) & (1<= a[1] <= 12):
  yymm = True

if yymm & mmyy:
  print('AMBIGUOUS')
elif (not yymm) & mmyy:
  print('MMYY') 
elif yymm & (not mmyy):
  print('YYMM')
else:
  print('NA')

Solution (Python):
def main():
    s = input()
    mm1 = False
    mm2 = False

    if 0 < int(s[:2]) < 13:
        mm1 = True
    if 0 < int(s[-2:]) < 13:
        mm2 = True
    
    if mm1 == True and mm2 == True:
        print("AMBIGUOUS")
        return 
    if mm1 == False and mm2 == False:
        print("NA")
        return
    if mm1 == True and mm2 == False:
        print("MMYY")
        return
    if mm1 == False and mm2 == True:
        print("YYMM")
        return
    print("NA")

if __name__ == '__main__':
    main()

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

try:
    first = int(S[:2])
except ValueError:
    first = -1

try:
    end = int(S[2:])
except ValueError:
    end = -1

def judgeYM(num):
    if num >= 1 and num <= 12:
        return "M"
    elif num >= 0 and num <=99:
        return "Y"
    else:
        return "N"

fj = judgeYM(first)
ej = judgeYM(end)

if fj == "N" or ej == "N":
    print("NA")
elif fj == "M" and ej == "M":
    print("AMBIGUOUS")
elif fj == "M":
    print("MMYY")
elif ej == "M":
    print("YYMM")
else:
    print("NA")

Solution (Python):

 
import math
import itertools
import sys
import copy
 






S = str(input())

YYMM = 0
MMYY = 0
if 1 <= int(S[0:2]) <= 12 :
  MMYY = 1
if 1 <= int(S[2:4]) <= 12 :
  YYMM = 1

if YYMM + MMYY == 2 :
  print ("AMBIGUOUS")
elif YYMM + MMYY == 0 :
  print ("NA")
elif YYMM == 1 :
  print ("YYMM")
else :
  print ("MMYY")

Solution (Python):
s=input()
s1=int(s[0]+s[1])
s2=int(s[2]+s[3])
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()
f = int(S[:2])
s = int(S[2:])

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

Solution (Python):

S = int(input())

X = int(S / 100) 
Z = S % 100      
if 1 <= X <= 12 and 1 <= Z <= 12:
    print("AMBIGUOUS")
elif (X == 0 or 13 <= X) and 1 <= Z <= 12:
    print("YYMM")
elif 1 <= X <= 12 and (Z == 0 or 13 <= Z):
    print("MMYY")
elif (X == 0 or 13 <= X) and (Z == 0 or 13 <= Z):
    print("NA")