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

Solution (Python):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

s = input()
s1 = s[0:2]
s2 = s[2:4]

if (s1[0]=="0" and s1[1]=="0") or(s2[0]=="0" and s2[1]=="0"):
    if  0<int(s1[0])*10+int(s1[1]) <12:
        print("MMYY")
    elif 0 < int(s2[0])*10+int(s2[1]) <12:
        print("YYMM")
    else:
        print("NA")
else:
    
    if s1[0]=="0":
        if s2[0]=="0":
            print("AMBIGUOUS")
        else:
            if eval(s2)>12:
                print("MMYY")
            else:
                print("AMBIGUOUS")
    else:
        
        if eval(s1)>12:
            if s2[0]=="0" or eval(s2) <= 12:
                print("YYMM")
            else:
                print("NA")
        else:
            if s2[0]=="0":
                print("AMBIGUOUS")
            else:
                if eval(s2)>12:
                    print("MMYY")
                else:
                    print("AMBIGUOUS")

Solution (Python):
s  = input()
sts=0
ff= int(s[:2])
ll = int(s[2:])
if ff==0  and (ll == 0 or 12<ll):
	sts=4
if ff==0  and 0<ll<13:
	sts=1
if 0<ff<13 and (ll == 0 or 12<ll):
	sts=2
if 0<ff<13 and 0<ll<13:
	sts=3
if 12<ff and (ll == 0 or 12<ll):
	sts=4
if 12<ff and 0<ll<13:
	sts=1
	
if sts == 1:
	print("YYMM")
if sts == 2:
	print("MMYY")
if sts == 3:
	print("AMBIGUOUS")
if sts == 4:
	print("NA")

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

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

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

Solution (Python):




 
X = [x for x in input()]
A = int(''.join(X[:2]))
B = int(''.join(X[2:]))

def is_month(n):
    if 0 < n and n <= 12:
        return True
    return False
    
def is_year(n):
    return True
 
if is_month(A) and is_month(B):
    print('AMBIGUOUS')
elif is_month(A) and is_year(B):
    print('MMYY')
elif is_year(A) and is_month(B):
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()


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

Solution (Python):

S = list(input())

front = int(S[0]+S[1])
rear = int(S[2]+S[3])


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

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

MMYY = "NO"
YYMM = "NO"

first2 = int(S[0:2])
last2 =  int(S[2:4])

if 13 > first2 > 0 and 99 >= last2 >= 0:
    MMYY = "YES"
if 99 >= first2 >= 0 and 13 > last2 > 0:
    YYMM = "YES"

if YYMM == "NO" and MMYY == "NO":
    print("NA")
elif YYMM == "YES" and MMYY == "NO": 
    print("YYMM")
elif YYMM == "NO" and MMYY == "YES":
    print("MMYY")
elif YYMM == "YES" and MMYY == "YES":
    print("AMBIGUOUS")

Solution (Python):
s=input()

if s[0:2]=="01" or s[0:2]=="02" or s[0:2]=="03" or s[0:2]=="04" or s[0:2]=="05" or s[0:2]=="06" or s[0:2]=="07" or s[0:2]=="08" or s[0:2]=="09" or s[0:2]=="10" or s[0:2]=="11" or s[0:2]=="12":
    if s[2:4]=="01" or s[2:4]=="02" or s[2:4]=="03" or s[2:4]=="04" or s[2:4]=="05" or s[2:4]=="06" or s[2:4]=="07" or s[2:4]=="08" or s[2:4]=="09" or s[2:4]=="10" or s[2:4]=="11" or s[2:4]=="12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s[2:4]=="01" or s[2:4]=="02" or s[2:4]=="03" or s[2:4]=="04" or s[2:4]=="05" or s[2:4]=="06" or s[2:4]=="07" or s[2:4]=="08" or s[2:4]=="09" or s[2:4]=="10" or s[2:4]=="11" or s[2:4]=="12":
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s = input()

mae = s[:2]
usiro = s[2:]

flag = 'NA'

if 1 <= int(mae) <= 12 and int(usiro) > 12 :
    flag = 'MMYY'
if 1 <= int(mae) <= 12 and int(usiro) == 0 :
    flag = 'MMYY'
if 1 <= int(usiro) <= 12 and int(mae) > 12:
    flag = 'YYMM'
if 1 <= int(usiro) <= 12 and int(mae) == 0:
    flag = 'YYMM'
if 1 <= int(mae) <= 12 and 1 <= int(usiro) <= 12:
    flag = 'AMBIGUOUS'

print(flag)

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

Solution (Python):
S = input()

f_ = S[0:2]
s_ = S[2:4]

if 0 < int(f_) < 13 and 0 < int(s_) < 13:
    print('AMBIGUOUS')
elif 0 < int(f_) < 13:
    print('MMYY')
elif 0 < int(s_) < 13:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input()

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

Solution (Python):
S = input()

a, b = S[:2], S[2:]

a_can_month = (1 <= int(a) <= 12)
b_can_month = (1 <= int(b) <= 12)

print([["NA", "YYMM"], ["MMYY", "AMBIGUOUS"]][a_can_month][b_can_month])

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

ue2keta = S // 100
shita2keta = S % 100

if (0 < ue2keta < 13) & ((shita2keta == 0) | (shita2keta > 12)):
    print("MMYY")
elif (0 < shita2keta < 13) & ((ue2keta == 0) | (ue2keta > 12)):
    print("YYMM")
elif (0 < ue2keta < 13) & (0 < shita2keta < 13):
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):
S = int(input())
top = S // 100 
bottom = S % 100 


topFlag = 2
bottomFlag = 2
if 1 <= top and top <= 12:
    topFlag = 1

if 1 <= bottom and bottom <= 12:
    bottomFlag = 1


if topFlag == 1 and bottomFlag == 1:
    print("AMBIGUOUS")
elif topFlag == 1 and bottomFlag == 2:
    print("MMYY")
elif topFlag == 2 and bottomFlag == 1:
    print("YYMM")
else:
    print("NA")

Solution (Python):
S = input()
fore = S[0:2]
back = S[2:4]
yymm_flag = False
mmyy_flag = False
if int(fore) > 12:
  yymm_flag = True
  mmyy_flag = False
  if int(back) > 12:
    yymm_flag = False
  elif int(back) <= 12 and int(back) != 0:
    yymm_flag = True
  elif int(back) == 0:
    yymm_flag = False
    mmyy_flag = False
elif int(fore) <= 12 and int(fore) != 0:
  yymm_flag = False
  mmyy_flag = True
  if int(back) > 12:
    mmyy_flag = True
  elif int(back) <= 12 and int(back) != 0:
    yymm_flag = True
  elif int(back) == 0:
    yymm_flag = False
    mmyy_flag = True
elif int(fore) == 0:
  if int(back) > 12:
    yymm_flag = False
    mmyy_flag = False
  elif int(back) <= 12 and int(back) != 0:
    yymm_flag = True
  elif int(back) == 0:
    yymm_flag = 0
    mmyy_flag = 0
if yymm_flag == True and mmyy_flag == False:
  print("YYMM")
elif yymm_flag == False and mmyy_flag == True:
  print("MMYY")
elif yymm_flag == True and mmyy_flag == True:
  print("AMBIGUOUS")
else:
  print("NA")

Solution (Python):
num = input()

num1 = int(num[0:2])
num2 = int(num[2:])

YYMM_flg = False
MMYY_flg = False

if num1 >= 1 and num1 <= 12:
    MMYY_flg = True

if num2 >= 1 and num2 <= 12:
    YYMM_flg = True

if YYMM_flg and MMYY_flg:
    print('AMBIGUOUS')
elif YYMM_flg:
    print('YYMM')
elif MMYY_flg:
    print('MMYY')
else:
    print('NA')

Solution (Python):


s = input()

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

Solution (Python):
s = input()

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

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

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

Solution (Python):
inp = input()
F = int(inp[:2])
B = int(inp[2:])
flagMMYY = False
flagYYMM = False
if F>=1 and F<=12:
  flagMMYY = True
if B>=1 and B<=12:
  flagYYMM = True
if flagMMYY and flagYYMM:
  print ('AMBIGUOUS')
elif flagMMYY:
  print ('MMYY')
elif flagYYMM:
  print ('YYMM')
else:
  print ('NA')

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

Solution (Python):
T = input()
F = T[:2]
S = T[2:]

def m(x):
    f = int(x[0])
    s = int(x[1])
    if f == 0:
        if 1 <= s <= 9:
            return True
        else:
            return False
    elif f == 1:
        if 0 <= s <= 2:
            return True
        else:
            return False
    else:
        return False

if m(F) and m(S):
    print("AMBIGUOUS")
elif m(F) and not m(S):
    print("MMYY")
elif not m(F) and m(S):
    print("YYMM")
else:
    print("NA")

Solution (Python):
S = input()

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

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

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

a=s//100
b=s%100

notYYMM = b < 1 or 12 < b

notMMYY = a < 1 or 12 < a

if notYYMM and notMMYY:
    print("NA")
elif not notYYMM and not notMMYY:
    print("AMBIGUOUS ")
elif not notYYMM and notMMYY:
    print("YYMM")
elif notYYMM and not notMMYY:
    print("MMYY")

Solution (Python):
from sys import stdin
S=(stdin.readline().rstrip())
if int(S[0:2]) == 0 and int(S[2:]) ==0:
    print("NA")
elif int(S[0:2]) > 12 and int(S[2:]) > 12:
    print("NA")
elif int(S[0:2]) > 12 and int(S[2:]) ==0:
    print("NA")
elif int(S[0:2]) == 0 and int(S[2:]) > 12:
    print("NA")
    
else :
    mae=0
    usiro=0
    if int(S[0:2]) > 12 or int(S[0:2]) == 0:
        mae = 1
    if int(S[2:]) > 12 or int(S[2:]) == 0:
        usiro = 1
    
    if mae == 0 and usiro == 0:
        print("AMBIGUOUS")
    elif mae == 0 and usiro ==1:
        print("MMYY")
    elif mae == 1 and usiro ==0:
        print("YYMM")

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

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

Solution (Python):
S = input()
s0 = int(S[0])
s1 = int(S[1])
s2 = int(S[2])
s3 = int(S[3])
num1 = s0*10 + s1
num2 = s2*10 + s3
if (num1 == 0 or 13 <= num1) and 1 <= num2 and num2 <=12:
    print("YYMM")
elif 1 <= num1 and num1 <= 12 and (num2 == 0 or 13 <= num2):
    print("MMYY")
elif 1 <= num1 and num1 <= 12 and 1 <= num2 and num2 <= 12:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):
def check_MM(S_C):
    MM_Check=['01','02','03','04','05','06','07','08','09','10','11','12']    
    if S_C in MM_Check:
        return 1
    else:
        return 0
    
S=input()

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

S1_Check=check_MM(S1)
S2_Check=check_MM(S2)

if S1_Check== 1:
    if S2_Check== 1:
        out='AMBIGUOUS'
    else:
        out='MMYY'
elif S1_Check== 0:
    if S2_Check== 1:
        out='YYMM'
    else:
        out='NA'
print(out)

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

if(M==0):
  if(Y==0):
    print('NA')
  else:
    print('YYMM')
elif(M>12):
  if(Y==0):
    print('NA')
  elif(Y>12):
    print('NA')
  else:
    print('YYMM')
else:
  if(Y==0):
    print('MMYY')
  elif(Y<13):
    print('AMBIGUOUS')
  else:
    print('MMYY')

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

    if ((A == 0) and (B > 12)) or ((B == 0) and (A > 12)):
        print("NA")
    elif ((A == 0) and (B == 0)):
        print("NA")
    elif ((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")

if __name__ == "__main__":
    main()

Solution (Python):
a = input()
mae = int(a[:2])
usiro = int(a[2:])

if(1 <= mae <= 12):
    if(1 <= usiro <= 12):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if(1 <= usiro <= 12):
        print('YYMM')
    else:
        print('NA')

Solution (Python):
S = input()

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

year_list = list(range(100))
month_list = list(range(1,13))

if (f in month_list) & (b in month_list):
    print("AMBIGUOUS")
elif (f in month_list) & (b not in month_list):
    print("MMYY")
elif (f not in month_list) & (b in month_list):
    print("YYMM")
else:
    print("NA")

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

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

Solution (Python):
A = list(int(i) for i in str(input()))
A, B = A[0]*10+A[1], A[2]*10+A[3]
if A == 0:
    if B == 0 or B>12:
        print("NA")
    else:
        print("YYMM")
elif A <= 12:
    if 0 < B and B <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < B and B <= 12:
        print("YYMM")
    else:
        print("NA")

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

Solution (Python):
s=input()

l=int(s[:2])
r=int(s[2:4])

ans=""

if l<=12 and l>=1:
  if r<=12 and r>=1:
    ans="AMBIGUOUS"
  else:
    ans="MMYY"
elif r<=12 and r>=1:
  ans="YYMM"
else:
  ans="NA"

print(ans)

Solution (Python):
if __name__ == "__main__":
    s = input()

    i1 = int(s[0:2])
    i2 = int(s[2:4])

    ans = ""
    if i1 == 0 or i2 == 0:
        if i1 == 0 and i2 == 0:
            ans = "NA"
        elif i1 == 0 and i2 < 13:
            ans = "YYMM"
        elif i2 == 0 and i1 < 13:
            ans = "MMYY"
        else:
            ans = "NA"
    else:
        if i1 < 13:
            if i2 < 13:
                ans = "AMBIGUOUS"
            else:
                ans = "MMYY"
        else:
            if i2 < 13:
                ans = "YYMM"
            else:
                ans = "NA"
    print(ans)

Solution (Python):
S = input()
SL = []
for i in range(1,13):
    SL.append("0"+str(i) if len(str(i)) == 1 else str(i))
 
 
if S[2:] in SL:
    if S[:2] in SL:
        print("AMBIGUOUS")
    else:
        print("YYMM")
    
else:
    if S[:2] in SL or SL[:2] == "00":
        print("MMYY")
    else:
        print("NA")

Solution (Python):
n = input()

a = n[0:2]
b = n[2:4]

a = int(a)
b = int(b)

if 0 < a <= 12 and 0 < b <= 12:
    print("AMBIGUOUS")

elif 0 < a <= 12 and (b > 12 or b == 0):
    print("MMYY")

elif 0 < b <= 12 and (a > 12 or a == 0):
    print("YYMM")

else:
    print("NA")

Solution (Python):
import numpy as np


v= list(str(input()))


li = list(np.array_split(v,2))

mae = int(''.join(li[0]))
usiro = int(''.join(li[1]))

ma = 0
usi = 0

if int(usiro) >= 1:
    if int(usiro) <= 12:
        usi = 1
    else:
        usi = 2
else:
    usi = 2

if int(mae) >= 1:
    if int(mae) <= 12:
        ma = 1
    else:
        ma = 2
else:
    ma = 2


if usi == 0:
    print('NA')
    exit()

if ma == 0:
    print('NA')
    exit()

if usi ==1:
    if ma == 1:

        print('AMBIGUOUS')
    else:
        print('YYMM')

if usi == 2:
    if ma == 1:

        print('MMYY')
    else:
        print('NA')

Solution (Python):
s = input()
aa = int(s[0:2])
bb = int(s[2:4])

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

Solution (Python):
S = input()
ue2 = int(S[0:2])
sita2 = int(S[2:4])
ue2_month_flag = False
sita2_month_flag = False

if ue2 < 13 and ue2 != 0:
    ue2_month_flag = True
if sita2 < 13 and sita2 != 0:
    sita2_month_flag = True

if ue2_month_flag and sita2_month_flag:
    print('AMBIGUOUS')
elif ue2_month_flag:
    print('MMYY')
elif sita2_month_flag:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()
fo = int(s[0] + s[1])
la = int(s[2] + s[3])
fism = 00 < fo and fo < 13
lism = 00 < la and la < 13
if fism and lism:
    ans = "AMBIGUOUS"
if fism and not lism:
    ans = "MMYY"
if not fism and lism:
    ans = "YYMM"
if not fism and not lism:
    ans = "NA"
print(ans)

Solution (Python):
s = input()

def mayBeMonth(n):
  if 1 <= n <= 12:
    return True
  else:
    return False

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

if mayBeMonth(first) and mayBeMonth(second):
  print("AMBIGUOUS")
elif mayBeMonth(first) and not mayBeMonth(second):
  print("MMYY")
elif not mayBeMonth(first) and mayBeMonth(second):
  print("YYMM")
else:
  print("NA")

Solution (Python):
x = input()

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

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

Solution (Python):
s=int(input())
k=s%100
l=(s-k)/100
k=int(k)
l=int(l)
if k<=12 and k>=1:
    if l>=1 and l<=12:
        ans='AMBIGUOUS'
    else:
        ans='YYMM'
elif l>=1 and l<=12:
    ans='MMYY'
else:
    ans='NA'
print(ans)

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

b = int(b)
c = int(c)

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

Solution (Python):
S = input()


def ismm(s):
    pat = [i+1 for i in range(12)]
    if int(s) in pat:
        return True
    else:
        return False
s1 = S[0:2]
s2 = S[2:4]



if ismm(s1):
    if ismm(s2):
        
        print('AMBIGUOUS')
    else :
        
        print('MMYY')
else:
    if ismm(s2):
        
        print('YYMM')
    else :
        print('NA')

Solution (Python):
s=input()
r = 'NA', 'MMYY', 'YYMM', 'AMBIGUOUS'
f = lambda x: 1 <= int(x) <= 12 
print(r[f(s[:2]) + 2 * f(s[2:])])

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

w1 = w[:2]
w2 = w[2:]

m = list(map(lambda x:'%02d' % x, range(1, 13)))
y = list(map(lambda x:'%02d' % x, range(0, 100)))


f1 =  w1 in m
f2 =  w1 in y
f3 =  w2 in m
f4 =  w2 in y


if (f1 and f4) and (f2 and f3):
    print("AMBIGUOUS")
elif ((not f1) and (f2)) and (f3):
    print('YYMM')
elif (f1 and f4) :
    print("MMYY")
else:
    print('NA')

Solution (Python):

s = input()

def year_chack(s):
    return True

def manth_check(s):
    if ( s == '01' or
            s == '02' or
            s == '03' or
            s == '04' or
            s == '05' or
            s == '06' or
            s == '07' or
            s == '08' or
            s == '09' or
            s == '10' or
            s == '11' or
            s == '12'):
        return True
    else :
        return False

frond = s[0] + s[1]
back = s[2] + s[3]


status = ""


if (year_chack(frond) and manth_check(back)):
    status = status + "1"
else :
    status = status + "0"


if (manth_check(frond) and year_chack(back)):
    status = status + "1"
else :
    status = status + "0"

if (status == "11"):
    print("AMBIGUOUS")
elif (status == "00"):
    print("NA")
elif (status == "01"):
    print("MMYY")
elif (status == "10"):
    print("YYMM")

Solution (Python):
data = input()

st1 = int(data[0]) * 10 + int(data[1])
st2  = int(data[2]) * 10 + int(data[3])

if (st1<= 12 and st1>=1) and (st2>= 1 and st2 <= 12):
  print("AMBIGUOUS")
elif (st1 >= 13 or st1 == 0) and (st2 != 0 and st2 <= 12):
  print("YYMM")
elif (st2 >= 13 or st2 == 0) and (st1 != 0 and st1 <= 12):
  print("MMYY")
else:
  print("NA")

Solution (Python):
num = input()

a = int(num) % 100
b = int(num) // 100

if 0 < a <= 12:
  if 0 < b <= 12:
    print("AMBIGUOUS")
  
  else:
    print("YYMM")
    

else:
  if 0 < b <= 12:
    print("MMYY")
  
  else:
    print("NA")

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

ans = 'NA'
pre = int(S[:2])
latter = int(S[2:])
flag1 = 0
flag2 = 0

if (1 <= latter) and (latter <= 12):
    flag1 = 1
if (1 <= pre) and (pre <= 12):
    flag2 = 1

if (flag1 == 1) and (flag2 == 1):
    ans = 'AMBIGUOUS'
elif (flag1 == 1):
    ans = 'YYMM'
elif (flag2 == 1):
    ans = 'MMYY'


print ans

Solution (Python):
s = list(input())
t = [int(n) for n in s]
a = t[0]*10+t[1]
b = t[2]*10+t[3]
if a>12 and b<=12 and b>0:
    print("YYMM")
elif a==0 and b<=12 and b>0:
    print("YYMM")
elif a<=12 and b>12 and a>0:
    print("MMYY")
elif a<=12 and b==0 and a>0:
    print("MMYY")
elif a<=12 and b<=12 and a>0 and b>0:
    print("AMBIGUOUS")
else :
    print("NA")

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

Solution (Python):
S = input()
s = list(S)
L = int(s[0] + s[1])
R = int(s[2] + s[3])
if 0< L <= 12:
    if 0<R<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')        
elif 0< R <= 12:
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
data = list( input() )
n1 = int( data[0] + data[1] )
n2 = int( data [2] + data[3] )

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

Solution (Python):

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

Solution (Python):
S = input()
YYMM, MMYY = False, 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):
n = int(input())
front = n // 100
back = n - front * 100
s=1
t=1
if 1 <= front <= 12 :
    s=2
if 1 <= back <= 12 :
    t=3
u = s*t
if u == 1:
    print('NA')
elif u == 2:
    print('MMYY')
elif u == 3:
    print('YYMM')
else:
    print('AMBIGUOUS')

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

a.append(s[0])
a.append(s[1])
b.append(s[2])
b.append(s[3])
a=int("".join(a))
b=int("".join(b))


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

Solution (Python):
import copy

class Solver:
    def __init__(self, _s):
        self.prefix = _s[0:2]
        self.suffix = _s[2:4]

        self.solve()
    
    def solve(self):
        isPrefixYY = False
        isPrefixMM = False
        isSuffixYY = False
        isSuffixMM = False

        intPrefix = int(self.prefix)
        intSuffix = int(self.suffix)

        if intPrefix >= 1 and intPrefix <= 12:
            isPrefixMM = True
        if intSuffix >= 1 and intSuffix <= 12:
            isSuffixMM = True
        if intPrefix >= 0 and intPrefix <= 99:
            isPrefixYY = True
        if intSuffix >= 0 and intSuffix <= 99:
            isSuffixYY = True

        if isPrefixMM == True and isPrefixYY == True and isSuffixMM == True and isSuffixYY == True:
            print("AMBIGUOUS")
        elif isPrefixMM == True and isSuffixYY == True:
            print("MMYY")
        elif isPrefixYY == True and isSuffixMM == True:
            print("YYMM")
        else:
            print("NA")

def main():
    s=input()
    Solver(s)



if __name__ == "__main__":
    main()

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

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

Solution (Python):
import queue

"""
N = int(input())



A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""
s = input()
f = int(s[:2])
e = int(s[2:])
t = 0
if f > 0 and f < 13:
	t += 1
if e > 0 and e < 13:
	t += 1
if t == 2:
	print("AMBIGUOUS")
elif t == 1:
	if f > 0 and f < 13:
		print("MMYY")
	else:
		print("YYMM")
else:
	print("NA")

Solution (Python):
num = input()
num_arr =[]
str_arr=[]

str_arr = list(num)
num_arr = [int(s) for s in str_arr]

if num_arr[0] == 0 and num_arr[1] != 0:
    if num_arr[2] == 0 and num_arr[3] != 0:
        print("AMBIGUOUS")
    elif num_arr[2] == 1 and 0 <=num_arr[3] <=2:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif num_arr[0] == 1 and 0 <=num_arr[1] <=2:
    if num_arr[2] == 0 and num_arr[3] != 0:
        print("AMBIGUOUS")
    elif num_arr[2] == 1 and 0 <=num_arr[3] <=2:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if num_arr[2] == 0 and num_arr[3] != 0:
        print("YYMM")
    elif num_arr[2] == 1 and 0 <=num_arr[3] <=2:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()

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

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

upper_2 = int(line / 100)
lower_2 = line % 100

if 1 <= upper_2 <= 12:
    if 1 <= lower_2 <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1 <= lower_2 <= 12:
    print("YYMM")
else:
    print("NA")

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


month1=0
month2=0
if int(first)>0 and int(first)<13:
    month1=1
if int(second)>0 and int(second)<13:
    month2=1

if month1==1 and month2==1:
    print('AMBIGUOUS')
elif month1==1 and month2==0:
    print('MMYY')
elif month1==0 and month2==1:
    print('YYMM')
else:
    print("NA")

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

M = 0
if 1 <= a <= 12:
    M = M | 1
if 1 <= b <= 12:
    M = M | 2

if M & 1 and M & 2:
    print("AMBIGUOUS") 
elif M & 1:
    print("MMYY")
elif M & 2:
    print("YYMM")
else:
    print("NA")

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



i=int(input())
lst = []

while i > 0:
    lst.append(i%10)
    i //= 10 
lst.reverse()
if len(lst)==3:
    lst.insert(0,0)
elif len(lst)==2:
    lst.insert(0,0)
    lst.insert(1,0)
elif len(lst)==1:
    lst.insert(0,0)
    lst.insert(1,0)
    lst.insert(2,0)
elif len(lst)==0:
    lst.insert(0,0)
    lst.insert(1,0)
    lst.insert(2,0)
    lst.insert(3,0)



if (int(str(lst[0])+str(lst[1]))>=1 and int(str(lst[0])+str(lst[1]))<=12) or (int(str(lst[2])+str(lst[3]))>=1 and int(str(lst[2])+str(lst[3]))<=12):
    if (int(str(lst[0])+str(lst[1]))>=1 and int(str(lst[0])+str(lst[1]))<=12) and (int(str(lst[2])+str(lst[3]))>=1 and int(str(lst[2])+str(lst[3]))<=12):
        print("AMBIGUOUS")
    elif int(str(lst[0])+str(lst[1]))>=1 and int(str(lst[0])+str(lst[1]))<=12:
        print("MMYY")
    elif int(str(lst[2])+str(lst[3]))>=1 and int(str(lst[2])+str(lst[3]))<=12:
        print("YYMM")
    else:
        print("NA")
else:
    print("NA")

Solution (Python):
s = input()

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

Solution (Python):
S=input()

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


if first==0 or first >12 :
  if second ==0 or second > 12:
    print("NA")
  else:
    print("YYMM")
    
elif second==0 or second >12 :
  if first==0 or first> 12:
    print("NA")
  else:
    print("MMYY")
else:

  print("AMBIGUOUS")

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

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

Solution (Python):
S = input()

if 0 <= int(S[0:2]) <= 99 and 1 <= int(S[2:4]) <= 12:
    if (13 <= int(S[0:2]) <= 99 or int(S[0:2]) == 0) and 1 <= int(S[2:4]) <= 12:
        print("YYMM")
    elif 1 <= int(S[0:2]) <= 12 and 1 <= int(S[2:4]) <= 12:
        print("AMBIGUOUS")

elif 1 <= int(S[0:2]) <= 12 and 0 <= int(S[2:4]) <= 99:
    if 1 <= int(S[0:2]) <= 12 and (13 <= int(S[2:4]) <= 99 or int(S[2:4]) == 0):
        print("MMYY")
    elif 1 <= int(S[0:2]) <= 12 and 1 <= int(S[2:4]) <= 12:
        print("AMBIGUOUS")

else:
    print("NA")

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

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