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=list(input())
Sf=S[0]+S[1]
Ss=S[2]+S[3]
Sf=int(Sf)
Ss=int(Ss)

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

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

if 1 <= a*10+b <= 12 and 1 <= c*10+d <= 12:
  print("AMBIGUOUS")
elif 0 <= a*10+b <= 99 and 1 <= c*10+d <= 12:
  print("YYMM")
elif 1 <= a*10+b <= 12 and 0 <= c*10+d <= 99:
  print("MMYY")
else:
  print("NA")

Solution (Python):
S = raw_input().strip()
a, b = S[0:2], S[2:]

ia = int(a)
ib = int(b)

if ib == 0:
    if ia >= 1 and ia <=12: 
        print('MMYY')
        exit()

if ia == 0:
    if ib >= 1 and ib <= 12:
        print('YYMM')
        exit()

if ia > 12:
    if ib > 12:
        print('NA')
    elif ib > 0:
        print('YYMM')
    else:
        print('NA')
elif ia >= 1:
    if ib >=1 and ib <= 12:
        print('AMBIGUOUS')
    elif ib > 12:
        print('MMYY')
    else:
        print('NA')
else:
    if ib == 0:
        print('NA')
    elif ib <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
S = input()


str12=int(S[0:2])
str34=int(S[2:4])

str12_enableMM = False
if 1 <= str12 and str12 <= 12:
    str12_enableMM = True

str34_enableMM = False
if 1 <= str34 and str34 <= 12:
    str34_enableMM = True



ans="NA"

if str12_enableMM is False:
    if str34_enableMM is False:
        pass
    else:
        ans = "YYMM"
else:
    if str34_enableMM is False:
        ans = "MMYY"
    else:
        ans = "AMBIGUOUS"

print(ans)

Solution (Python):
s = input()

s_list = [int(x) for x in list(s)]

a = s_list[0]*10+s_list[1]
b = s_list[2]*10+s_list[3]

form = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']

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

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

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

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

YM=MY=False
if 0<B<=12: YM=True
if 0<A<=12: MY=True

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

Solution (Python):
def solve(s):
    if int(s[0:2]) == 0 and int(s[2:4]) == 0:
        print("NA")
        return 0
    if int(s[0:2]) > 12 and int(s[2:4]) > 12:
        print("NA")
        return 0
    if 0 < int(s[0:2]) < 13 and 0 < int(s[2:4]) < 13:
        print("AMBIGUOUS")
        return 0
    elif 0 < int(s[2:4]) < 13:
        print("YYMM")
        return 0
    elif 0 < int(s[0:2]) < 13:
        print("MMYY")
        return 0
    else:
        print("NA")
        return 0


if __name__ == "__main__":
    S = input()
    solve(S)

Solution (Python):
S = input()
A = int(S[0:2])
B = int(S[2:4])
Ayy = 0
Amm = 0
Byy = 0
Bmm = 0
if A == 0:
    Ayy = 1
elif A <= 12:
    Ayy = 1
    Amm = 1
else:
    Ayy = 1

if B == 0:
    Byy = 1
elif B <= 12:
    Byy = 1
    Bmm = 1
else:
    Byy = 1

if Amm:
    if Bmm:
        print('AMBIGUOUS')
    elif Byy:
        print('MMYY')
    else:
        print('NA')
elif Ayy:
    if Bmm:
        print('YYMM')
    else:
        print('NA')
else:
    print('NA')

Solution (Python):
import math
def judge(Y):
    year = int(Y)
    former = math.floor(year/100)
    latter = year%100
    if(former >= 1 and former <= 12):
        if(latter >= 1 and latter <= 12):
            return("AMBIGUOUS")
        elif(latter == 0 or latter > 12):
            return("MMYY")
    elif(former == 0 or former > 12):
        if(latter >= 1 and latter <= 12):
            return("YYMM")
        elif(latter == 0 or latter > 12):
            return("NA")

S = input()
print(judge(S))

Solution (Python):
s_format = input()

first2 = int(s_format[0]+s_format[1])

last2 = int(s_format[2]+s_format[3])




if 0 < first2 < 13 and 0 < last2 < 13:
    print("AMBIGUOUS")
elif 0 < first2 < 13 and last2 > -1:
    print("MMYY")
elif first2 > -1 and 0 < last2 < 13:
    print("YYMM")
else:
    print("NA")

Solution (Python):
S = input().strip()
m = int(S[:2])
n = int(S[2:])

res = None
if 1 <= m <= 12 and 1 <= n <= 12:
    res = 'AMBIGUOUS'
elif 1 <= m <= 12:
    res = 'MMYY'
elif 1 <= n <= 12:
    res = 'YYMM'
else: res = 'NA'

print(res)

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


main()

Solution (Python):
a = list(input()) 
for i in range(len(a)):
    a[i] = int(a[i])
ue = a[0]*10 + a[1]
sita = a[2]*10 + a[3]
if (ue > 12) & (sita > 12):
    print('NA')
elif (ue <= 12) & (sita <= 12):
    if (sita + ue) == 0:
        print('NA')
    elif (ue == 0):
        print('YYMM')
    elif (sita == 0):
        print('MMYY')
    else:
        print('AMBIGUOUS')
elif ue > 12:
    if (sita <= 12) & (sita > 0):
        print('YYMM')
    else:
        print('NA')
elif sita > 12:
    if (ue <= 12) & (ue > 0):
        print('MMYY')
    else:
        print('NA')

Solution (Python):
S=input()

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

YYMM=True
MMYY=True
AMBIGUOUS=True
NA=True


if left<=0 or left>12:
  MMYY=False
  AMBIGUOUS=False
else:
  NA=False
  
if right<=0 or right>12:
  YYMM=False
  AMBIGUOUS=False
else:
  NA=False


if YYMM==True:
  if MMYY==True:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if MMYY==True:
    print("MMYY")
  else:
    print("NA")

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

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

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

Solution (Python):
S = input()

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

isYYMM = 1 <= b <= 12
isMMYY = 1 <= a <= 12

if isYYMM and isMMYY:
    print('AMBIGUOUS')
elif isYYMM:
    print('YYMM')
elif isMMYY:
    print('MMYY')
else:
    print('NA')

Solution (Python):
a=input()
i=0
n=[]
while i<len(a):
  n.append(a[i])
  i+=1
pd=n[0]+n[1]
sd=n[2]+n[3]
pd=int(pd)
sd=int(sd)
if sd==0 and pd==0:
  print('NA')
elif pd>12:
  if sd>=1 and sd<=12:
    print('YYMM')
  elif sd>12:
    print('NA')
  elif sd<1:
    print('NA')
elif pd==0:
  if sd>12:
    print('NA')
  elif sd>0 and sd<=12:
    print('YYMM')
elif pd<=12 and pd!=0:
  if sd>12:
    print ('MMYY')
  elif sd==0:
    print('MMYY')
  elif sd<=12 and sd!=0:
    print('AMBIGUOUS')

Solution (Python):
import sys

S = input()

A = int(''.join(S[0:2]))
B = int(''.join(S[2:4]))

if S[0:2] == '00' or S[2:4] == '00':
    if 0 < A <= 12:
        print('MMYY')

    elif 0 < B <= 12:
        print('YYMM')
    else:
        print('NA')

else:
    if 12 < A and 12 < B:
        print('NA')

    if  0 <= B and B <= 12:
        if  0 <= A and A <= 12:
            print('AMBIGUOUS')
        else:
            print('YYMM')

    elif 0 <= A and A <= 12:
        print('MMYY')

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

Solution (Python):


s = input()

a = []
for i in s:
    a.append(i)

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

c = a[2] + a[3]
c = int(c)

dec1 = 0
dec2 = 0

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

Solution (Python):





def judge_category(i):
    if(1 <= i and i <= 12):
        return 1
    elif (0 <= i and i <= 99):
        return 2
    else:
        return 3


S = list(input())
left = int(S[0] + S[1])
right = int(S[2] + S[3])

a_l = judge_category(left)
a_r = judge_category(right)

if(a_l == 3 or a_r == 3):
    print("NA")
elif(a_l == 1 and a_r == 1):
    print("AMBIGUOUS")
elif(a_l == 1 and a_r == 2):
    print("MMYY")
elif(a_l == 2 and a_r == 1):
    print("YYMM")
elif(a_l == 2 and a_r == 2):
    print("NA")

Solution (Python):
a = input()
dic = {'01': 1, '02': 2, '03': '3','04': 1, '05': 2, '06': '3','07': 1, '08': 2, '09': '3','10': 1, '11': 2, '12': '3'}
b = a[0:2]
c = a[2:4]
if c in dic and b in dic:
	print("AMBIGUOUS")
if c in dic and b not in dic:
	print("YYMM")
if c not in dic and b in dic:
	print("MMYY")
if c not in dic and b not in dic:
	print("NA")

Solution (Python):
s = input()

A = s[0:2]
B = s[2:4]

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

Solution (Python):

S = input()
year = 99
month = 12
mae, ushiro = int(S[:2]), int(S[2:])
if 0 < mae <= month and 0 < ushiro <= month:
	print("AMBIGUOUS")
elif 0 < mae <= month and 0 <= ushiro <= year:
	print("MMYY")
elif 0 <= mae <= year and 0 < ushiro <= month:
	print("YYMM")
else:
	print("NA")

Solution (Python):
S = input()

mm = int(S[2:])
if mm == 0 or mm > 12:
    yymm = False
else:
    yymm = True

mm = int(S[:2])
if mm == 0 or mm > 12:
    mmyy = False
else:
    mmyy = True

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

Solution (Python):
S = int(input())
ans = "NA"
up2 = (S // 100) % 100
du2 = S % 100

if 0 < up2 < 13 and 0 < du2 < 13:
    ans = "AMBIGUOUS"
elif up2 > 12 and 0 < du2 < 13:
    ans = "YYMM"
elif du2 > 12 and 0 < up2 < 13:
    ans = "MMYY"
elif du2 == 0 and 0 < up2 < 13:
    ans = "MMYY"
elif up2 == 0 and 0 < du2 < 13:
    ans = "YYMM"
else:
    ans = "NA"

print(ans)

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

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

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

first = int(N/100)
second = N - first*100

f_YY = False
s_YY = False
f_MM = False
s_MM = False

if 0 <= first and first <= 99:
    f_YY = True
if 0 <= second and second <= 99:
    s_YY = True
if 1 <= first and first <= 12:
    f_MM = True
if 1 <= second and second <= 12:
    s_MM = True
    
if (f_YY == True and s_MM == True) and\
    (f_MM == True and s_YY == True):
    print('AMBIGUOUS')
elif f_YY == True and s_MM == True:
    print('YYMM')
elif f_MM == True and s_YY == True:
    print('MMYY')
else:
    print('NA')

Solution (Python):


S = str(input())
f_half = int(S[0:2])
s_half = int(S[2:4])



if 0 < f_half and f_half <= 12 :
  if 0 < s_half and s_half <= 12 :
    print("AMBIGUOUS")
  else :
    print("MMYY")

else:
  if 0 < s_half and s_half <= 12 :
    print("YYMM")
  else :
    print("NA")

Solution (Python):
S = list(input())
S1 = int("".join(S[0:2]))
S2 = int("".join(S[2:4]))
 
if (12 >= S1 and S1 >= 1) and (12 >= S2 and S2 >= 1):
  print('AMBIGUOUS')
elif (12 >= S1 and S1 >= 1):
  print('MMYY')
elif (12 >= S2 and S2 >= 1):
  print('YYMM')
else :
  print('NA')

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

after = S % 100
before = S //100

if after >31 and before > 31:
  print("NA")
else:
  if before <= 12 and before >0:
    if after <= 12 and after >0:
      print("AMBIGUOUS")
    else:
      print("MMYY")
  else:
    if after <= 12 and after > 0:
      print("YYMM")
    else:
      print("NA")

Solution (Python):


import sys                                                      
sys.setrecursionlimit(10**6)                                    
from collections import deque, Counter                          
from itertools   import accumulate, permutations, combinations  
from operator    import itemgetter                              
from bisect      import bisect_left, bisect_right, bisect       
from heapq       import heappop, heappush                       
from fractions   import gcd                                     
from math        import ceil, floor, sqrt, cos, sin, tan, pi    
from copy        import deepcopy                                
import numpy         as np                                      


def main():
    
    im = InputManager()
    
    s = im.inputSingle(dtype=str)
    
    aa = int(s[0:2])
    bb = int(s[2:4])
    canYYMM = False
    canMMYY = False
    if (bb >= 1 and bb <= 12):
        canYYMM = True
    if (aa >= 1 and aa <= 12):
        canMMYY = True
    
    if (canYYMM and canMMYY):
        print("AMBIGUOUS")
    elif (canYYMM):
        print("YYMM")
    elif (canMMYY):
        print("MMYY")
    else:
        print("NA")
    
    return


class InputManager(object):
    def __init__(self):
        pass

    @staticmethod
    def inputSingle(dtype=int):
        return dtype(input())
    
    @staticmethod
    def inputMultiple(dtype=int, aslist=False):
        if aslist:
            return list(map(dtype, input().split()))
        else:
            return map(dtype, input().split())

    @staticmethod
    def input2D(h, dtype=int):
        return [list(map(dtype, input().split())) for i in range(h)]


main()

Solution (Python):
s = input()
a=s[0:2]
b=s[2:4]
if a =="00" or int(a)>12:
  if b=="01" or b=="02"or b=="03"or b=="04" or b=="05" or b=="06" or b=="07" or b=="08" or b=="09" or b=="10" or b=="11" or b=="12":
    print("YYMM")
  else:
    print("NA")
elif a=="01" or a=="02"or a=="03"or a=="04" or a=="05" or a=="06" or a=="07" or a=="08" or a=="09" or a=="10" or a=="11" or a=="12":
  if b=="01" or b=="02"or b=="03"or b=="04" or b=="05" or b=="06" or b=="07" or b=="08" or b=="09" or b=="10" or b=="11" or b=="12":
    print("AMBIGUOUS")
  else:
    print("MMYY")

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

fw = S[:2]
bw = S[2:]

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



if fw in MList and bw in MList :
    print('AMBIGUOUS')
elif fw in MList :
    print('MMYY')
elif bw in MList :
    print('YYMM')
else:
    print('NA')

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

if (not(1 <= int(S[0])*10+int(S[1]) <= 12)) and (not(1 <= int(S[2])*10+int(S[3]) <= 12)):
    print('NA')

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

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

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

    if f == 00 or f > 12:
        if b == 00 or b > 12:
            print('NA')
        elif b < 13:
            print('YYMM')
    else:
        if b == 00 or b > 12:
            print('MMYY')
        elif b < 13:
            print('AMBIGUOUS')

except EOFError:
    pass

Solution (Python):
S = input()
Sf = int(S[:2])
Sb = int(S[2:])
F = 0 < Sf <= 12
B = 0 < Sb <= 12
if F and B:
    ans = 'AMBIGUOUS'
elif F and not B:
    ans = 'MMYY'
elif not F and B:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)

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

Solution (Python):
S = list(input())
former = 0
latter = 0

if int(S[0]) == 0:
    former = int(S[1])
else:
    former = int(S[0]+S[1])


if int(S[2]) == 0:
    latter = int(S[3])
else:
    latter = int(S[2] + S[3])


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

Solution (Python):
s = input()
lst = [i for i in s]
left = "".join([lst[0], lst[1]])
right = "".join([lst[2], lst[3]])
left = int(left)
right = int(right)
if left > 12:
    if right > 12 or right == 0:
        print("NA")
    elif 0<right <13:
        print("YYMM")
elif 0<left<13:
    if right > 12:
        print("MMYY")
    elif 0<right<13:
        print("AMBIGUOUS")
    elif right == 0:
        print("MMYY")
elif left == 0:
    if 0 < right < 13:
        print("YYMM")
    elif right == 0 or right >12:
        print("NA")

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

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

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

S_1 = int(S[:2])
S_2 = int(S[2:])

if (S_1 <=12) and (S_2 <= 12) and (S_1 != 0) and (S_2 != 0):
    print('AMBIGUOUS')

elif (S_1 <= 12) and (S_2 > 12) and (S_1 != 0) and (S_2 != 0):
    print('MMYY')
elif (0 < S_1 <= 12) and (S_2 == 0):
    print('MMYY')

elif (S_1 > 12) and (S_2 <= 12) and (S_1 != 0) and (S_2 != 0):
    print('YYMM')
elif (S_1 == 0) and (0 < S_2 <= 12):
    print('YYMM')

elif (S_1 > 12) and (S_2 > 12) and (S_1 != 0) and (S_2 != 0):
    print('NA')
elif (S_1 == 0) or (S_2 == 0):
    print('NA')

Solution (Python):


S=input()


A=int(S[:2])
B=int(S[2:])



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

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


def decide(x):
    if x==0 or 13<=x<=99:
        return 0  
    elif 1<=x<=12:
        return 1  
f=decide(former)
l=decide(latter)
if f==0 and l==1:
    print('YYMM')
elif f==1 and l==0:
    print('MMYY')
elif f==0 and l==0:
    print('NA')
else:
    print('AMBIGUOUS')

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

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

if (last<13 and first<13) and (last>0 and first>0):
    print("AMBIGUOUS")
    
elif (last==0 or first==0) and (last>12 or first>12) :
    print("NA")

elif last>12 and first>12:
    print("NA")
elif last==0 and first==0:
    print("NA")

elif (first>12 or first==0) and (last<13 and last>0) :
    print("YYMM")

elif (last>12 or last==0) and (first<13 and first>0) :
    print("MMYY")

Solution (Python):

n = str(input())
b = n[:2]
a = n[2:]
be = int(b)
af = int(a)
if 13<=be<=99 and 1<=af<=12:
    print("YYMM")
elif 1<=be<=12 and 13<=af<=99:
    print("MMYY")
elif 1<=be<=12 and 1<=af<=12:
    print("AMBIGUOUS")
elif be==0 and 1<=af<=12:
    print("YYMM")
elif 1<=be<=12 and af==0:
    print("MMYY")
else:
    print("NA")

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

def check_mm(n):
    if  0 < n and n < 13:
        return True
    else:
        return False

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

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

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 = str(input())

front = S[0]+S[1]
rear = S[2]+S[3]

front=int(front)
rear=int(rear)

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

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

Solution (Python):
S=input()

F=int(S[:2])
A=int(S[2:])

if F>12 or F==0:
    if A>12 or A==0:
        print('NA')
    else:
        print('YYMM')
elif A>12 or A==0:
    print('MMYY')
else:
    print('AMBIGUOUS')

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

s0 = int(S[0:2])
s1 = int(S[2:4])
def MM(x):
    if 1<= x <= 12:
        return True
    else:
        return False
if MM(s0) == True:
    if MM(s1) == True:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if MM(s1) == True:
        print("YYMM")
    else:
        print("NA")

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

Solution (Python):
a = input()
m1 = False
m2 = False

ab = int(a[:2])
cd = int(a[2:])
if ab > 0 and ab <= 12:
  m1 = True

if cd > 0 and cd <= 12:
  m2 = True

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

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

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

if a == 0:
	if b == 0 or b > 12:
		ans = 'NA'
	elif 1 <= b <= 12:
		ans = 'YYMM'
elif 1 <= a <= 12:
	if b == 0 or b > 12:
		ans = 'MMYY'
	elif 1 <= b <= 12:
		ans = 'AMBIGUOUS'
elif a > 12:
	if b == 0 or b > 12:
		ans = 'NA'
	if 1 <= b <= 12:
		ans = 'YYMM'

print(ans)

Solution (Python):
import bisect
import math
def solve():
  s = int(input())
  if s == 0:
    print("NA")
    exit()
  
  if s//100 != 0 and s//100 <= 12:
    tp = s%100
    if 1<= tp and tp <= 12:
      print("AMBIGUOUS")
    elif tp == 0:
      print("MMYY")
    elif 13 <= tp and tp <= 99:
      print("MMYY")
    else:
      print("NA")
  else:
    tp = s%100
    if 1<= tp and tp <= 12:
      print("YYMM")
    else:
      print("NA")
solve()

Solution (Python):
target = input()
first, second = int(target[0:2]), int(target[2:4])
if first == 0:
  first = 100
if second == 0:
  second = 100

def check():
  if first >12 and second >12:
    return 'NA'
  elif first <= 12 and second <= 12:
    return 'AMBIGUOUS'
  elif first >12 and second <= 12:
    return 'YYMM'
  else:
    return 'MMYY'

if __name__ == '__main__':
  print(check())

Solution (Python):
S = input()

front = int(S[:2])
rear = int(S[2:])



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

Solution (Python):
S = input()
import datetime

strptime = datetime.datetime.strptime

try:
  strptime(S, '%y%m')
  can_be_yymm = True
except ValueError as e1:
  can_be_yymm = False

try:
  strptime(S, '%m%y')
  can_be_mmyy = True
except ValueError as e2:
  can_be_mmyy = False

if can_be_yymm and can_be_mmyy:
  print('AMBIGUOUS')
elif can_be_yymm and not can_be_mmyy:
  print('YYMM')
elif not can_be_yymm and can_be_mmyy:
  print('MMYY')
else:
  print('NA')

Solution (Python):
s = input()

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




def formatCheck(data):
	if  1 <= data and data <= 12 :
		return True
	else:
		return False

result_front = formatCheck(front)
result_back = formatCheck(back)

if result_front:
	if result_back:
		result = "AMBIGUOUS"
	else:
		result = "MMYY"
else:
	if result_back:
		result = "YYMM"
	else:
		result = "NA"

print(result)

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

front = int(S[:2])
rear = int(S[2:])

if 0 < front < 13 :
    F_month = True
else:
    F_month = False
    
if 0 < rear < 13 :
    R_month = True
else:
    R_month = False

if F_month == True and R_month == False:
    print('MMYY')

if F_month == True and R_month == True:
    print('AMBIGUOUS')

if F_month == False and R_month == False:
    print('NA')

if F_month == False and R_month == True:
    print('YYMM')

Solution (Python):
S = input()

T = S[:2]
U = S[2:]

if (int(T) > 12 or int(T) == 0) and 12 >= int(U) >= 1:
  print('YYMM')
elif (int(U) > 12 or int(U) == 0) and 12 >= int(T) >= 1:
  print('MMYY')
elif (12 >= int(T) >= 1) and (12 >= int(U) >= 1):
  print('AMBIGUOUS')
else:
  print('NA')

Solution (Python):
S = input()
num_be = int(S[:2])
num_af = int(S[2:])

if ( ((num_be > 12) & (num_af > 12)) or ( (num_be == 0) & (num_af == 0) ) or ( (num_be == 0) & (num_af > 12) ) or ( (num_be > 12) & (num_af == 0)) ) :
  print('NA')
elif ( ((num_be > 0) & (num_be < 13)) & ((num_af > 0) & (num_af < 13)) ):
  print('AMBIGUOUS')
elif((num_be > 12) or (num_be == 0) ):
  print('YYMM')
else:
  print('MMYY')

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

f_bool = (front <13)&(front>0)
b_bool = (back <13)&(back>0)
if f_bool ^ b_bool:
    if f_bool:
        print("MMYY")
    
    else:
        print("YYMM")
elif f_bool:
    print("AMBIGUOUS")
else:
    print("NA")

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

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

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

left = moji[0]+moji[1]
right = moji[2]+moji[3]
left = int(left)
right = int(right)

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

Solution (Python):


S = input()

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

Solution (Python):
def judge_format(text):
    former, latter = int(text[:2]), int(text[2:])
    if 1 <= former <= 12 and (latter == 0 or latter > 12):
        return 'MMYY'
    elif 1 <= latter <= 12 and (former == 0 or former > 12):
        return 'YYMM'
    elif 1 <= former <= 12 and 1 <= latter <= 12:
        return 'AMBIGUOUS'
    else:
        return 'NA'
    

def main():
    s = input()
    print(judge_format(s))


main()

Solution (Python):

s = input()

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

former_mm_flag = False
if former <= 12 and former > 0:
    former_mm_flag = True

latter_mm_flag = False
if latter <= 12 and latter > 0:
    latter_mm_flag = True

if former_mm_flag:
    if latter_mm_flag:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if latter_mm_flag:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
import sys
import numpy as np

def main():
	dp =input()
	mae = int(dp[0])*10 + int(dp[1])
	ushiro = int(dp[2])*10 + int(dp[3])
	if 1 <= mae <= 12 and  1<=ushiro <= 12:
		print("AMBIGUOUS")
	elif 1 <= mae <= 12 and  (ushiro > 12 or ushiro==0):
		print("MMYY")
	elif (mae > 12 or mae ==0) and  1 <= ushiro <= 12:
		print("YYMM")
	else:
		print("NA")   
main()

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

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

Solution (Python):
Y=input()
X=[]
X=list(Y) 

A=[]
A.append(X[0])
A.append(X[1])
a=''.join(A)
a=int(a)

B=[]
B.append(X[2])
B.append(X[3])
b=''.join(B)
b=int(b)


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

elif b==0 and 1<=a<=12:
    print('MMYY')
elif b==0 and 13<=a<=99:
    print('NA')
elif b==0 and a==0:
    print('NA')

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

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

if s1 > 12 or s1 == 0:
    temp1 = 0
else:
    temp1 = 1

if s2 > 12 or s2 == 0:
    temp2 = 0
else:
    temp2 = 1


if temp1 == 0 and temp2 == 1:
    print("YYMM")
if temp1 == 0 and temp2 == 0:
    print("NA")
if temp1 == 1 and temp2 == 0:
    print("MMYY")
if temp1 == 1 and temp2 == 1:
    print("AMBIGUOUS")