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()
c=0
if 0<int(s[0])*10+int(s[1])<13:c+=1
if 0<int(s[2])*10+int(s[3])<13:c+=2
print("AMBIGUOUS" if c==3 else "YYMM" if c==2 else "MMYY" if c==1 else "NA")

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


if 1 <= int(S[0]+S[1]) <= 12:
    if 1 <= int(S[2]+S[3]) <= 12:
        print('AMBIGUOUS')
        exit()
if 0 <= int(S[0]+S[1]) <= 99:
    if 1 <= int(S[2]+S[3]) <= 12:
        print('YYMM')
        exit()
if 1 <= int(S[0]+S[1]) <= 12:
    if 0 <= int(S[2]+S[3]) <= 99:
        print('MMYY')
        exit()
print('NA')

Solution (Python):
import math
import heapq
import sys
from collections import Counter
import numpy as np
import datetime





S=input()
try:
    a = datetime.date(int('20'+S[:2]), int(S[2:]), 1)
    try:
        a = datetime.date(int('20'+S[2:]), int(S[:2]), 1)
        print('AMBIGUOUS')
    except ValueError:
        print('YYMM')
except ValueError:
    try:
        a = datetime.date(int('20'+S[2:]), int(S[:2]), 1)
        print('MMYY')
    except ValueError:
        print('NA')

Solution (Python):
a,b,c,d = input()

li1 = [a,b]
li2 = [c,d]

int1 = int(''.join(li1))
int2 = int(''.join(li2))

if (int1 in range(1,13)) and (int2 in range(1,13)):
    ans = 'AMBIGUOUS'
elif (int1 in range(1,13)) and (int2 not in range(1,13)):
    ans = 'MMYY'
elif (int2 in range(1,13)) and (int1 not in range(1,13)):
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)

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

Solution (Python):
S = input()

S_zen =int(S[0:2])
S_go = int(S[2:4])

judge_list_MM = [1+i for i in range(12)]



if S_zen in judge_list_MM and S_go in judge_list_MM :
    print("AMBIGUOUS")
elif S_go in judge_list_MM :
    print("YYMM")
elif S_zen in judge_list_MM :
    print("MMYY")
else :
    print("NA")

Solution (Python):
n = input()

a = n[0]+n[1]
a = int(a)

b = n[2]+n[3]
b = int(b)



if a==0:
	if b==0:
		print('NA')
	elif 0<b<13:
		print('YYMM')
	else:
		print('NA')

elif 0<a<13:
	if b==0:
		print('MMYY')
	elif 0<b<13:
		print('AMBIGUOUS')
	else:
		print('MMYY')	

else:
	if b==0:
		print('NA')
	elif 0<b<13:
		print('YYMM')
	else:
		print('NA')

Solution (Python):
s = input()
f = int(s[:2])
b = int(s[2:4])
jdg = str(int(0 < f and f <= 12)) + str(int(0 < b and b <= 12))
if jdg == '11':
    print('AMBIGUOUS')
elif jdg == '10':
    print('MMYY')
elif jdg == '01':
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
import sys
input = sys.stdin.readline
def print_ans(S):
    """Test Case
    >>> print_ans("1905")
    YYMM
    >>> print_ans("0112")
    AMBIGUOUS
    >>> print_ans("1700")
    NA
    """
    front = int(S[:2])
    rear = int(S[2:])
    frontMM_flg = 1 <= front <= 12
    rearMM_flg = 1 <= rear <= 12
    if frontMM_flg and rearMM_flg:
        print("AMBIGUOUS")
    elif frontMM_flg and not rearMM_flg:
        print("MMYY")
    elif not frontMM_flg and rearMM_flg:
        print("YYMM")
    else:
        print("NA")
    


if __name__ == '__main__':
    S = input().rstrip()
    print_ans(S)

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


if 1 <= int(a) <= 12 and 1 <= int(b) <= 12:
    print("AMBIGUOUS")
elif 1 <= int(a) <= 12 and (int(b) < 1 or int(b) > 12):
    print("MMYY")
elif 1 <= int(b) <= 12 and (int(a) < 1 or int(a) > 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 == 0) or (12 < s1 <= 99)) and (1 <= s2 <= 12):
    print("YYMM")
elif (1 <= s1 <= 12) and ((s2 == 0) or (12 < s2 <= 99)):
    print("MMYY")
else:
    print("NA")

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

Solution (Python):
S = input()
m, n = S[0:2], S[2:4]

if S[0] == '0':
  m = int(S[1])
else:
  m = int(m)
if S[2] == '0':
  n = int(S[3])
else:
  n = int(n)

if 0 < m <= 12 and 0 < n <= 12:
  print('AMBIGUOUS')
elif (m == 0 or m > 12) and 0 < n <= 12:
  print('YYMM')
elif 0 < m <= 12 and (n == 0 or n > 12):
  print('MMYY')
else:
  print('NA')

Solution (Python):
S=input()

if 0<=int(S[0]+S[1])<=99 and 1<=int(S[2]+S[3])<=12:
    yymm='True'
else:
    yymm='False'
if 1<=int(S[0]+S[1])<=12 and 0<=int(S[2]+S[3])<=99:
    mmyy='True'
else:
    mmyy='False'

if yymm=='True' and mmyy=='False':
    print('YYMM')
elif yymm=='False' and mmyy=='True':
    print('MMYY')
elif yymm=='True' and mmyy=='True':
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):


A=input()
Y=int(A[0])*10+int(A[1])
M=int(A[2])*10+int(A[3])
code=0
if Y<100:
    if M>0 and M<13:
        code=1

if M<100:
    if Y>0 and Y<13:
        if code==1:
            code=3
        else:
            code=2

if code == 0:
    print("NA")
if code ==1:
    print("YYMM")
if code ==2:
    print("MMYY")
if code == 3:
    print("AMBIGUOUS")

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

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

Solution (Python):



def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def isMM(s2):
    d = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    return s2 in d

def main():
    s = input()
    if isMM(s[0:2]):
        if isMM(s[2:]):
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if isMM(s[2:]):
            print("YYMM")
        else:
            print("NA")


if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()

s1 = int(s[:2])
s2 = int(s[2:])


if 1<=s1 and s1<=12 and 1<=s2 and s2<=12:
  ret="AMBIGUOUS"
elif 0<=s1 and s1<=99 and 1<=s2 and s2<=12:
  ret="YYMM"
elif 0<=s2 and s2<=99 and 1<=s1 and s1<=12:
  ret="MMYY"
else:
  ret="NA"


print(ret)

Solution (Python):

s = input()
first = int(s[0] + s[1])
last = int(s[2] + s[3])

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

Solution (Python):
S=input()
m0=0

if int(S[:2])<=12 and int(S[:2])>0:
  m0+=1
if int(S[2:])<=12 and int(S[2:])>0:
  m0+=2

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

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

Solution (Python):
s = [int(i) for i in input()]
f = s[0]*10 + s[1]
l = s[2]*10 + s[3]

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

Solution (Python):
s = input()

sf = int(s[:2])
sb = int(s[2:])

mmyy = (0 < sf and sf < 13)
yymm = (0 < sb and sb < 13)

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

Solution (Python):
s = input()

s = [int(i) for i in s]
ue2 = s[0] * 10 + s[1]
sita2 = s[2] * 10 + s[3]

yymm = False
mmyy = False
amb = False


if  1 <= sita2 <= 12:
    yymm = True
    
    if 1 <= ue2 <= 12:
        amb = True
        yymm = False

else:
    if 1<= ue2 <= 12:
        
        mmyy = True
if yymm:
    print("YYMM")
elif mmyy:
    print("MMYY")
elif amb:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):
S = input()

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

Solution (Python):
def main():
    S = input()
    a = S[:2]
    b = S[2:]

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


if __name__ == '__main__':
    main()

Solution (Python):
s=input()
a=int("".join(s[0:2]))
b=int("".join(s[2:4]))
ans=0
if b<13 and b!=00:
    ans+=1
if a<13 and a!=00:
    ans+=2
if ans==3:
    print("AMBIGUOUS")
elif ans==2:
    print("MMYY")
elif ans==1:
    print("YYMM")
else:
    print("NA")

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

if 0 < S // 100 <= 12 and 0 < S % 100<= 12:
    print("AMBIGUOUS")
elif 0 < S // 100 <= 12:
    print("MMYY")
elif 0 < S % 100 <= 12:
    print("YYMM")
else :
    print("NA")

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

former=int("".join(s[0:2]))
latter=int("".join(s[2:4]))

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

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

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

Solution (Python):
s = int(input())
s_12 = int(s / 100)
s_34 = s - s_12 * 100

if 1 <= s_12 <= 12:
    if 1 <= s_34 <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= s_34 <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s = input().strip()

first = int(s[0] + s[1])
second = int(s[2] + s[3])

if (first == 0):
    if (second == 0):
        print("NA")
    elif (1 <= second <= 12):
        print("YYMM")
    elif (13 <= second <= 99):
        print("NA")
    else:
        print("NA")
elif (1 <= first <= 12):
    if (second == 0):
        print("MMYY")
    elif (1 <= second <= 12):
        print("AMBIGUOUS")
    elif (13 <= second <= 99):
        print("MMYY")
    else:
        print("NA")
elif (13 <= first <= 99):
    if (second == 0):
        print("NA")
    elif (1 <= second <= 12):
        print("YYMM")
    elif (13 <= second <= 99):
        print("NA")
    else:
        print("NA")
else:
    print("NA")

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

date = [int(s[:2]), int(s[2:])]

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

Solution (Python):
import sys
sys.setrecursionlimit(10**9)
INF=10**18
def input():
    return sys.stdin.readline().rstrip()

def main():
    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')

if __name__ == '__main__':
    main()

Solution (Python):

import sys










def main():
    s = sys.stdin.readline().rstrip()
    first, second = int(s[:2]), int(s[2:])
    if 1 <= first <= 12:
        if 1 <= second <= 12:
            ans = 'AMBIGUOUS'
        else:
            ans = 'MMYY'
    else:
        if 1 <= second <= 12:
            ans = 'YYMM'
        else:
            ans = 'NA'
    print(ans)



if __name__ == "__main__":
    main()

Solution (Python):
S = int(input())
a = S // 100
b = S % 100
def f(p,q):
    if p ==1:
        if q == 1:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if q == 1:
            return 'YYMM'
        else:
            return 'NA'
s = 0
t = 0
if 1 <= a <= 12:
    s = 1
if 1 <= b <= 12:
    t = 1
print(f(s,t))

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


s1=int(s[0])*10+int(s[1])
s2=int(s[2])*10+int(s[3])

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

Solution (Python):
n=input()
ym=0
my=0
if n[0]=="0":
  if int(n[1])!=0:
    my=1
  else:
    my=0
elif n[0]=="1":
  if int(n[1])==1 or int(n[1])==2:
    my=1
  else:
    my=0
else:
  my=0
if n[2]=="0":
  if int(n[3])!=0:
    ym=1
  else:
    ym=0
elif n[2]=="1":
  if int(n[3])==1 or int(n[3])==2:
    ym=1
  else:
    ym=0
else:
  ym=0
if my and ym:
  print("AMBIGUOUS")
elif my:
  print("MMYY")
elif ym:
  print("YYMM")
else:
  print("NA")

Solution (Python):
N = int(input())
a = N // 100
b = N % 100
ans = 'NA'
x = 1 <= a <= 12
y = 1 <= b <= 12
if x and y:
    ans = 'AMBIGUOUS'
elif x and not y:
    ans = 'MMYY'
elif not x and y:
    ans = 'YYMM'

print(ans)

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

def check(t):
  if t > 0 and t < 13:
    return True
  return False


if check(s1):
  if check(s2):
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif check(s2):
  print("YYMM")
else:
  print("NA")

Solution (Python):
s = input()

front = s[0:2]
back = s[2:4]

a = 0
b = 0
if 1 <= int(front) <= 12:
    a = 1
if 1 <= int(back) <= 12:
    b = 1

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

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

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

Solution (Python):
S = input()

left = int(S[:2])
right = int(S[2:])
left_mm_flag = False
left_yy_flag = False
right_mm_flag = False
right_yy_flag = False

if 0 <= left <= 99:
    left_yy_flag = True
    if 1 <= left <= 12:
        left_mm_flag = True


if 0 <= right <= 99:
    right_yy_flag = True
    if 1 <= right <= 12:
        right_mm_flag = True


if left_mm_flag and right_yy_flag and left_yy_flag and right_mm_flag:
    print('AMBIGUOUS')
elif left_yy_flag and right_mm_flag:
    print('YYMM')
elif left_mm_flag and right_yy_flag:
    print('MMYY')
else:
    print('NA')

Solution (Python):
x = [i for i in input()]
a,b=int(x[0]+x[1]),int(x[2]+x[3])
if (1<=a and a<=12) and (1<=b and b<=12):
  print("AMBIGUOUS")
elif 1<=a and a<=12:
  print("MMYY")
elif 1<=b and b<=12:
  print("YYMM")
else:
  print("NA")

Solution (Python):
s = input()
mae = s[:2]
ato = s[2:]
val = ""
if mae == "00":
	if ato == "00":
		val = "NA"
	elif int(ato) >= 13:
		val = "NA"
	else:
		val = "YYMM"
elif int(mae) >= 13:
	if ato == "00":
		val = "NA"
	elif int(ato) >= 13:
		val = "NA"
	else:
		val = "YYMM"
else:
	if ato == "00":
		val = "MMYY"
	elif int(ato) >= 13:
		val = "MMYY"
	else:
		val = "AMBIGUOUS"
print (val)

Solution (Python):
S = input()
u = int(S[0]) * 10 + int(S[1])
d = int(S[2]) * 10 + int(S[3])

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

Solution (Python):
s = input()

uis_noty = False
lis_noty = False

if int(s[0]) > 1 or (int(s[0]) == 1 and int(s[1]) > 2) or (int(s[0]) == 0 and int(s[1]) == 0):
  uis_noty = True
if int(s[2]) > 1 or (int(s[2]) == 1 and int(s[3]) > 2) or (int(s[2]) == 0 and int(s[3]) == 0):
  lis_noty = True

if uis_noty == True and lis_noty == True:
  print('NA')
elif uis_noty == False and lis_noty == True:
  print('MMYY')
elif uis_noty == True and lis_noty == False:
  print('YYMM')
else:
  print('AMBIGUOUS')

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

Solution (Python):
s = input()

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

Solution (Python):
l = list(str(input()))
l1 = [l[0], l[1]]
l2 = [l[2], l[3]]

a = int(''.join(l1))
b = int(''.join(l2))

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

Solution (Python):

S = input()
S1 = int(S[:2])
S2 = int(S[2:])
A = (S1 >= 1 and S1 <= 12)
B = (S2 >= 1 and S2 <= 12)
if(A and B):
  print('AMBIGUOUS')
elif(A and not B):
  print('MMYY')
elif(not A and B):
  print('YYMM')
else:
  print('NA')

Solution (Python):
S = input()

HEAD = int(S[:2])
TAIL = int(S[2:])

if HEAD > 0 and HEAD < 13:
  if TAIL > 0 and TAIL < 13:
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif TAIL > 0 and TAIL < 13:
  if HEAD > 0 and HEAD < 13:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  print("NA")

Solution (Python):

S = list(input())
f = int((''.join(S[0:2])))
b = int((''.join(S[2:4])))
def month(m):
    if 1 <= m <= 12:
        return 1
    else:
        return 0
def year(y):
    return 1
ans = [month(f),year(b),year(f),month(b)]

if sum(ans) == 4:
    print('AMBIGUOUS')
elif ans[0] == 1 and ans[1] == 1:
    print('MMYY')
elif ans[2] == 1 and ans[3] == 1:
    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):
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    
    
    S=input()
    u=int(S)//100
    d=int(S[2:])
    if(1<=u<=12 and 1<=d<=12):
        print('AMBIGUOUS')
    elif(1<=u<=12 and (d==0 or d>12)):
        print('MMYY')
    elif((not 1<=u<=12) and 1<=d<=12):
        print('YYMM')
    else:
        print('NA')
resolve()

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

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

Solution (Python):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,string,queue
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Solution (Python):



S = int(input())



yymm = 0
mmyy = 0

if S % 100 <= 12 and S % 100 != 0:
    yymm = 1
if S // 100 <= 12 and S // 100 != 0:
    mmyy = 1

if yymm == 1 and mmyy == 1:
    print('AMBIGUOUS')
elif yymm == 1 and mmyy != 1:
    print('YYMM')
elif yymm != 1 and mmyy == 1:
    print('MMYY')
else:
    print('NA')

Solution (Python):



S = int(input())



yymm = 0
mmyy = 0

if S % 100 <= 12 and S % 100 != 0:
    yymm = 1
if S // 100 <= 12 and S // 100 != 0:
    mmyy = 1

if yymm == 1 and mmyy == 1:
    print('AMBIGUOUS')
elif yymm == 1 and mmyy != 1:
    print('YYMM')
elif yymm != 1 and mmyy == 1:
    print('MMYY')
else:
    print('NA')

Solution (Python):
s = input()
s = [int(i) for i in s]

if 1 <= s[0]*10+s[1] <= 12:
    if 1 <= s[2]*10+s[3] <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= s[2]*10+s[3] <= 12:
    if 1 <= s[0]*10+s[1] <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    print('NA')

Solution (Python):


MOD = 10 ** 9 + 7

s = input()

ans = 0
ans += 1 if 0 < int(s[:2]) < 13 else 0
ans += 2 if 0 < int(s[2:]) < 13 else 0

if ans == 0:
    print('NA')
elif ans == 1:
    print('MMYY')
elif ans == 2:
    print('YYMM')
elif ans == 3:
    print('AMBIGUOUS')

Solution (Python):
S=list(input())
b1=int(S[0]+S[1])
b2=int(S[2]+S[3])
if 0<b1<13 and 0<b2<13:
    print('AMBIGUOUS')
    
elif (b1==0 or b1>12) and 13>b2>0:
    print('YYMM')
elif 0<b1<13 and (b2==0 or b2>12):
    print('MMYY')
else:
    print('NA')

Solution (Python):
S = str(input())
fr = int(S[0]+S[1])
sc = int(S[2]+S[3])

if fr<=12 and fr!=0:
  if sc<=12 and sc!=0:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if sc<=12 and sc!=0:
    print('YYMM')
  else:
    print('NA')

Solution (Python):
S = str(input())
fr = int(S[0]+S[1])
sc = int(S[2]+S[3])

if fr<=12 and fr!=0:
  if sc<=12 and sc!=0:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if sc<=12 and sc!=0:
    print('YYMM')
  else:
    print('NA')

Solution (Python):



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


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

Solution (Python):
n=str(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<=a<=12:
  print('MMYY')
elif 1<=b<=12:
  print('YYMM')
else:
  print('NA')

Solution (Python):
S=input()

months=["{:02}".format(m) for m in range(1,13)]

pre_p = S[:2] in months
post_p = S[2:] in months

if pre_p:
    if post_p:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if post_p:
        print("YYMM")
    else:
        print("NA")

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

Solution (Python):
S = input()

S_p1 = S[:2]
S_p2 = S[2:]

def is_MM(s):
    return int(s) >= 1 and int(s) <= 12

if is_MM(S_p1) and is_MM(S_p2):
    print("AMBIGUOUS")
elif not is_MM(S_p1) and not is_MM(S_p2):
    print("NA")
elif is_MM(S_p1):
    print("MMYY")
elif is_MM(S_p2):
    print("YYMM")

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

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


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

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

Solution (Python):
month1 = ["0" + str(i) for i in range(1,10)]
month2 = ["10","11","12"]

s = input()
a = 0
b = 0
if s[0] + s[1] in month1 + month2:
    a = 1
if s[2] + s[3] in month1 + month2:
    b = 1
if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA")

Solution (Python):
s = int(input())
def is_month(x):
  if x == 0 or x >= 13:
    return False
  else:
    return True
if is_month(s // 100):
  if is_month(s % 100):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if is_month(s % 100):
    print('YYMM')
  else:
    print('NA')

Solution (Python):
S = input()

FF = int(S[:2])
SS = int(S[2:])

FF = FF >= 1 and FF <= 12
SS = SS >= 1 and SS <= 12

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

Solution (Python):
s = input()
mmyy = False
yymm = False



if 0 < int(s[0:2]) <= 12:
    mmyy = True
if 0 < int(s[2:4]) <= 12:
    yymm = True

if mmyy is True and yymm is not True:
    print('MMYY ')
elif yymm is True and mmyy is not True:
    print('YYMM')
elif mmyy is True and yymm is True:
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):
def main():
    s = list(input())
    first = int(''.join(s[:2]))
    end = int(''.join(s[2:4]))

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


if __name__ == '__main__':
    main()

Solution (Python):
s = list(input())
up = int(''.join(s[:2]))
low = int(''.join(s[2:]))

if up > 0 and up < 13:
  if low > 0 and low < 13:
    print('AMBIGUOUS')
  
  elif low >= 0:
    print('MMYY')
  
  else:
    print('NA')

elif low > 0 and low < 13:
  if up >= 0:
    print('YYMM')
  else:
    print('NA')
    
else:
  print('NA')

Solution (Python):
s = input()
nn = int(s[:2])
dd = int(s[2:])

if nn > 0 and nn <= 12 and dd > 0 and dd <=12:
  print("AMBIGUOUS")
elif nn > 0 and nn <= 12:
  print("MMYY")
elif dd > 0 and dd <= 12:
  print("YYMM")
else:
  print("NA")

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

Solution (Python):

import sys


def solve(S: int):

    if 0 <= int(S[:2]) <= 99 and 1 <= int(S[2:]) <= 12:
        if 1 <= int(S[:2]) <= 12:
            print("AMBIGUOUS")
        else:
            print("YYMM")
    elif 1 <= int(S[:2]) <= 12 and 0 <= int(S[2:]) <= 99:
        if 1 <= int(S[2:]) <= 12:
            print("AMBIGUOUS")
        else:
            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):

import sys


def solve(S: int):

    if 1 <= int(S[2:]) <= 12:
        if 1 <= int(S[:2]) <= 12:
            print("AMBIGUOUS")
        else:
            print("YYMM")
    else:
        if 1 <= int(S[:2]) <= 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()

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

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

Solution (Python):
S = input()
m = ["01", "02","03","04","05","06","07","08","09","10","11","12"]
if S[:2] in m and S[2:] in m:
  print("AMBIGUOUS")
elif S[:2] in m:
  print("MMYY")
elif S[2:] in m:
  print("YYMM")
else:
  print("NA")

Solution (Python):
s = input()

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

pre = s[0:2]
post = s[2:]

if (check(pre) and check(post)):
    print('AMBIGUOUS')
elif (not check(pre) and check(post)):
    print('YYMM')
elif (check(pre) and not check(post)):
    print('MMYY')
else:
    print('NA')

Solution (Python):
s = input()
s12 = s[0] + s[1] 
s34 = s[2] + s[3]

if int(s12) >= 13 or s12 == "00": 
  if int(s34) >= 13 or s34 == "00": 
    print("NA")
  else: 
    print("YYMM")
else:
  if 1 <= int(s12) <= 12:
    if 1 <= int(s34) <= 12:
      print("AMBIGUOUS")
    else:
      print("MMYY")

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

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

Solution (Python):
s = int(input())
pre, suf = 0 < s//100 <= 12, 0 < s % 100 <= 12
print(['NA', 'YYMM', 'MMYY', 'AMBIGUOUS'][pre*2+suf])

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

if 1 <= pre <= 12:
    if 1 <= suf <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= suf <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
s = input()
ah = int(s[0:2])
be = int(s[2:])

yymm = False
mmyy = False
na = False

if 1<=ah<=12:
    mmyy = True
if 1<=be<=12:
    yymm = True

if mmyy == True:
    if yymm == True:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif yymm == True:
    print('YYMM')
else:
    print('NA')

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