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()
forward = int(s[0:2])
back = int(s[2:4])
mmyy = False
yymm = False

if 1 <= forward <= 12:
    mmyy = True
if 1 <= back <= 12:
    yymm = True

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

Solution (Python):
S = list(input())
s1, s2 = int("".join(S[:2])), int("".join(S[2:]))

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

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

Solution (Python):
s = input()

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

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

Solution (Python):





import sys
input = sys.stdin.readline

S = input()




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

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

Solution (Python):
S=input()
if int(S[:2])>12 or S[:2]=='00':
  if int(S[2:])>12 or S[2:]=='00':
    print("NA")
  else:
    print("YYMM")
elif int(S[2:])>12 or S[2:]=='00':
  if int(S[:2])>12 or S[:2]=='00':
    print("NA")
  else:
    print("MMYY")
else:
  print("AMBIGUOUS")

Solution (Python):
s = input()

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

flag1=False
flag2=False
if 13>s1 and s1>0:
    flag1 = True
if 13>s2 and s2>0:
    flag2 = True
    
if flag1:
    if flag2:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if flag2:
        print("YYMM")
    else:
        print("NA")

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

mae = suuji // 100
ushiro = suuji % 100

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

Solution (Python):
s = input()

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


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

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

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

Solution (Python):
S = input()
lst = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]

up = S[0:2]
low = S[2:4]


if up in lst and low in lst:
    ans = "AMBIGUOUS"
elif up in lst and low not in lst:
    ans = "MMYY"
elif up not in lst and low in lst:
    ans = "YYMM"
else:
    ans = "NA"


print(ans)

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

Solution (Python):


S = input()
S[:2], S[2:]

def isM(str):
    return 1 <= int(str) <= 12

def isY(str):
    return True

def isYYMM(str):
    YY, MM = str[:2], str[2:]
    return isY(YY) and isM(MM)

def isMMYY(str):
    MM, YY = str[:2], str[2:]
    return isM(MM) and isY(YY)

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

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

if 0 < s0 < 13:
    if 0 < s1 < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < s1 < 13:
        print("YYMM")
    else:
        print("NA")

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

mae = (s - (s%100))/100
ushiro = s%100

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

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

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

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

print(ans)

Solution (Python):
S = input()
s = []

for i in range(4):
    s.append(S[i])

mon = int(s[2] + s[3])
yer = int(s[0] + s[1])

if 1 <= mon <= 12:
    if 1 <= yer <= 12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if 1 <= yer <= 12:
        print('MMYY')
    else:
        print('NA')

Solution (Python):
S = input()

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


if 1 <= b and b <= 12:
  yymm = 1
else:
  yymm = 0
  

if 1 <= a and a <= 12:
  mmyy = 1
else:
  mmyy = 0
  
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().strip()
s1,s2 = S[:2],S[2:]
def is_month(s): 
    return int(s) >=1 and int(s)<=12

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

Solution (Python):
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = ns()
a = (int(s[:2]) <= 12 and int(s[:2]) > 0)
b = (int(s[2:]) <= 12 and int(s[2:]) > 0)

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):
import sys
stdin = sys.stdin
def ls(): return stdin.readline()
S = ls()
first, second = int(S[:2]), int(S[2:])
def is_my(f, s):
    return 0 < f < 13

def is_ym(f, s):
    return 0 < s < 13
ym, my = is_ym(first,second), is_my(first, second)
if ym and my:
    print("AMBIGUOUS")
elif ym and not my:
    print("YYMM")
elif my and not ym:
    print("MMYY")
else:
    print("NA")

Solution (Python):

a=input()
yy=int(a[:2])
mm=int(a[2:])

def isYM(yy,mm):
    if(0<mm and mm<=12):
        return True
    return False
        
def isMY(yy,mm):
    return isYM(mm,yy)


ym=isYM(yy,mm)
my=isMY(yy,mm)
if ym==True and my==True:
    print("AMBIGUOUS")
elif ym==False and my==True:
    print("MMYY")
elif my==False and ym==True:
    print("YYMM")
else:
    print("NA")

Solution (Python):
s = str(input())
s1 = s[:2]
s2 = s[2:]

ans = 'NA'
if 0 < int(s1) <= 12 and 0 < int(s2) <= 12:
    ans = 'AMBIGUOUS'
if 0 < int(s1) <= 12 and int(s2) > 12:
    ans = 'MMYY'
if int(s1) > 12 and 0 < int(s2) <= 12:
    ans = 'YYMM'
if 0 < int(s1) <= 12 and int(s2) == 0:
    ans = 'MMYY'
if int(s1) == 0 and 0 < int(s2) <= 12:
    ans = 'YYMM'

print(ans)

Solution (Python):



def is_month(dst):
    a = int(dst)
    if a < 1:
        return False
    elif a > 12:
        return False
    else:
        return True

def main():
    N = input()
    f = N[:2]
    b = N[2:]
    if is_month(f) :
        if is_month(b):
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if is_month(b):
            print('YYMM')
        else:
            print('NA')


if __name__ == "__main__":
    main()

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

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

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

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

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


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

Solution (Python):
def is_MM(s):
    return (s > 0) and (s < 13)

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

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

Solution (Python):
S = input()
F = int(S[:2])
R = int(S[2:])
FF = 0 < F and F < 13
RR = 0 < R and R < 13

if FF and RR:
    print('AMBIGUOUS')
elif FF:
    print('MMYY')
elif RR:
    print('YYMM')
else:
    print('NA')

Solution (Python):
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

S = stdin.readline().rstrip()

A = S[:2]
B = S[2:]

isYYMM = False
isMMYY = False

if int(B) <= 12 and int(B) >= 1:
    isYYMM = True

if int(A) <= 12 and int(A) >= 1:
    isMMYY = True

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

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

Solution (Python):
s_in=input()
fore=int(s_in[:2])
aft=int(s_in[2:])

if 1<=fore<=12:
    if 1<=aft<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=aft<=12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
S = input()

N1 = int(S[0:2])
N2 = int(S[2:4])

judge = (N1 < 1 or N1 > 12) * 1 + (N2 < 1 or N2 > 12) * 2 

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

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

Solution (Python):
s = input()
s1, s2 = int(s[:2]), int(s[2:])
s1_bool = 1 <= s1 <= 12
s2_bool = 1 <= s2 <= 12

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

Solution (Python):
s = input()
u = s[:2]
d = s[2:]
if '12'>= u >= '01':
    umm = True
else:
    umm = False
if '12'>= d >= '01':
    dmm = True
else:
    dmm = False
if umm and dmm:
    print('AMBIGUOUS')
elif umm:
    print('MMYY')
elif dmm:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()
if (s[:2] > '12' or s[:2] == '00') and s[2:] < '13' and s[2:] > '00':
    print('YYMM')
elif s[:2] > '00' and s[:2] < '13' and (s[2:] > '12' or s[2:] == '00'):
    print('MMYY')
elif s[:2] > '00' and s[:2] < '13' and s[2:] < '13' and s[2:] > '00':
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):
S = input()
S1, S2 = S[0:2], S[2:4]

months = [str(i).zfill(2) for i in range(1, 13)] 
years = [str(i).zfill(2) for i in range(0, 100)]

yymm = False
mmyy = False
if S1 in months and S2 in years:
    mmyy = True
if S1 in years and S2 in months:
    yymm = True
if mmyy and not yymm:
    print("MMYY")
elif not mmyy and yymm:
    print("YYMM")
elif mmyy and yymm:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):
s=list(str(input()))
s1=int("".join(s[:2]))
s2=int("".join(s[2:]))
if s1>0 and s1<= 12:
    if s2>0 and s2<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if s2>0 and s2<=12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):

S = input()
def checkMonth(s):
    num = int(s[0]) * 10 + int(s[1])
    if num >= 1 and num <= 12:
        return True
    else:
        return False
early = S[:2]
late = S[2:]

earlyIsMonth = checkMonth(early)
lateIsMonth = checkMonth(late)
if earlyIsMonth and lateIsMonth:
    print ("AMBIGUOUS")
elif earlyIsMonth and not lateIsMonth:
    print ("MMYY")
elif not earlyIsMonth and lateIsMonth:
    print ("YYMM")
else:
    print ("NA")

Solution (Python):
S = input()

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

Solution (Python):
s = int(input())
s1 = s%100
s2 = int((s-s1)/100)
ans = 0
if 0 < s1 and s1 < 13:
	if 0 < s2 and s2 < 13:
		print("AMBIGUOUS")
		exit()
	else:
		print("YYMM")
		exit()
else:
	if 0 < s2 and s2 < 13:
		print("MMYY")
		exit()
	else:
		print("NA")
		exit()

Solution (Python):
S = list(map(int,list(input())))

if 1 <= S[0] * 10 + S[1] <= 12 and 1 <= S[2] * 10 + S[3] <= 12:
    print("AMBIGUOUS")
    exit()
if 1 <= S[0] * 10 + S[1] <= 12 and 0 <= S[2] * 10 + S[3]:
    print("MMYY")
    exit()
if 0 <= S[0] * 10 + S[1] and 1 <= S[2] * 10 + S[3] <= 12:
    print("YYMM")
    exit()

print("NA")

Solution (Python):
s = input()

yymm = mmyy = False

if int(s[:2]) <= 12 and int(s[:2]) >= 1:
    mmyy = True

if int(s[2:]) <= 12 and int(s[2:]) >= 1:
    yymm = True

res = ''
if yymm and mmyy:
    res = 'AMBIGUOUS'
elif yymm:
    res = 'YYMM'
elif mmyy:
    res = 'MMYY'
else:
    res = 'NA'

print(res)

Solution (Python):










import sys


def get_array(): return list(map(int, sys.stdin.readline().split()))


def get_ints(): return map(int, sys.stdin.readline().split())


def input(): return sys.stdin.readline().strip()


def main():
    s = input()
    a = int(s[:2])
    b = int(s[2:])
    if (a > 12 and b > 12) or (a > 12 and b == 0) or (a == 0 and b > 12):
        print('NA')
        return

    if a == 0 and b <= 12 and b > 0:
        print("YYMM")
        return
    if b == 0 and a <= 12 and a > 0:
        print("MMYY")
        return

    if a <= 12 and b <= 12 and a > 0 and b > 0:
        print('AMBIGUOUS')
        return

    if a <= 12 and a != 0:
        print("MMYY")
        return
    if b <= 12 and b != 0:
        print("YYMM")
        return
    print('NA')


if __name__ == "__main__":
    main()

Solution (Python):
import sys
from collections import Counter

s = input()
f = 10 * int(s[0]) + int(s[1])
l = 10 * int(s[2]) + int(s[3])
f_flg = 0
l_flg = 0

if 1 <= f <= 12:
    f_flg = 1

if 1 <= l <= 12:
    l_flg = 1


if f_flg == l_flg == 1:
    print('AMBIGUOUS')
elif f_flg == 0 and l_flg == 1:
    print('YYMM')
elif f_flg == 1 and l_flg == 0:
    print('MMYY')
else:
    print('NA')

Solution (Python):
YYMM = 'YYMM'
MMYY = 'MMYY'
AMB = 'AMBIGUOUS'
NA = 'NA'

aabb = input()

aa = aabb[0:2]
naa = int(aa)
bb = aabb[2:]
nbb = int(bb)

fYYMM = (1 <= nbb <= 12)
fMMYY = (1 <= naa <= 12)

if fYYMM and fMMYY:
    print(AMB)
elif fYYMM and not fMMYY:
    print(YYMM)
elif not fYYMM and fMMYY:
    print(MMYY)
elif not fYYMM and not fMMYY:
    print(NA)
else:
    assert(False)

Solution (Python):
S = input()
a = S[:2]
b = S[2:]
aj = 0
bj = 0
aa = int(a)
bb = int(b)
if 0<aa<13:
  aj = 1
if 0<bb<13:
  bj = 1
p = ''
if aj==bj==0:
  p = 'NA'
elif aj==bj==1:
  p = 'AMBIGUOUS'
elif aj==0 and bj ==1:
  p = 'YYMM'
else:
  p = 'MMYY'
print(p)

Solution (Python):
S = input()
if 1 <= int(S[: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()

if int(S[0:2]) < 99 and 0 < int(S[2:4]) < 13:
    if int(S[2:4]) < 99 and 0 < int(S[0:2]) < 13:
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif int(S[2:4]) < 99 and 0 < int(S[0:2]) < 13:
    if int(S[0:2]) < 99 and 0 < int(S[2:4]) < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    print('NA')

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

S_top = S // 100
S_bottom = S % 100

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

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

res = 'NA'
bf = (int(S[0])) * 10 + int(S[1])
af = (int(S[2])) * 10 + int(S[3])

if  0 <= bf and  0 < af < 13:
      res = 'YYMM'
      
if  0 < bf < 13 and  0 <= af:
    if res == 'YYMM':
      res = 'AMBIGUOUS'
      
    else:
      res = 'MMYY'
      
print(res)

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

Solution (Python):
a = input()
b = int(a[:2])
c = int(a[2:])
def judge(num):
  if num > 0 and num <= 12:
    return True
  else:
    return False
if judge(b) and judge(c):
  print("AMBIGUOUS")
elif judge(b):
  print("MMYY")
elif judge(c):
  print("YYMM")
else:
  print("NA")

Solution (Python):
s=input()

a=''
b=''
for i in range(2):
    a=a+s[i]
for j in range(2,4):
    b=b+s[j]    
a=int(a)
b=int(b)

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

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

Solution (Python):
S = input()
 
befM = False
aftM = False
 
for i in range(1, 13):
    num = str(i).zfill(2)
    if num == S[0:2]:
        befM = True
    if num == S[2:4]:
        aftM = True
 
ans = "NA"
if befM and aftM:                  
    ans = "AMBIGUOUS"
elif aftM:         
    ans = "YYMM"
elif befM:         
    ans = "MMYY"

print(ans)

Solution (Python):
s = input()

pre = int(s[:2])
suf = int(s[2:])

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

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

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

Solution (Python):
s = input()
ftwo = int(s[:2])
ltwo = int(s[2:])

if ftwo > 12 and ltwo > 12:
    print('NA')
elif ltwo == 0 and 0 < ftwo <= 12:
    print('MMYY')
elif 0 < ltwo <=12 and ftwo == 0:
    print('YYMM')
elif ltwo == 0 or ftwo == 0:
    print('NA')
elif ftwo > 12 and 0 < ltwo <=12:
    print('YYMM')
elif 0 < ftwo <= 12 and ltwo > 12:
    print('MMYY')
else:
    print("AMBIGUOUS")

Solution (Python):

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

Solution (Python):
s = int(input())
a = int(s/100)
b = s%100


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

Solution (Python):
S = input()
def is_year(ss):
    return 0 <= int(ss) <= 99

def is_month(ss):
    return 1 <= int(ss) <= 12

pre = S[:2]
suf = S[2:]
try:
    is_yymm = is_year(pre) and is_month(suf)
    is_mmyy = is_year(suf) and is_month(pre)
    if is_yymm and is_mmyy:
        print('AMBIGUOUS')
    elif is_yymm and not is_mmyy:
        print('YYMM')
    elif not is_yymm and is_mmyy:
        print('MMYY')
    else:
        assert False
except:
    print('NA')

Solution (Python):
s = input()

zen = int(s[0:2])
kou = int(s[2:4])

ym = False
my = False
if 1 <= zen and zen <= 12:
    my = True
if 1 <= kou and kou <= 12:
    ym = True

if my and ym:
    print('AMBIGUOUS')
elif my:
    print('MMYY')
elif ym:
    print('YYMM')
else:
    print('NA')

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

s1 = S[0] + S[1]
s2 = S[2] + S[3]

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

Solution (Python):



s = input()

fs = s[:2]
bs = s[2:]

if fs>"00" and fs<="12":
    if bs>"00" and bs<="12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if bs>"00" and bs<="12":
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s=list(input())
YYMM=False
MMYY=False

if s[2]=='0' and s[3]!='0': YYMM=True
elif s[2]=='1' and int(s[3])<=2: YYMM=True

if s[0]=='0' and s[1]!='0': MMYY=True
elif s[0]=='1' and int(s[1])<=2: MMYY=True


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

Solution (Python):



def is_mm(format_2_char):
    n = int(format_2_char)
    if 1 <= n <= 12:
        return True
    return False


def judge(cand):
    if is_mm(cand[0:2]):
        if is_mm(cand[2:]):
            return('AMBIGUOUS')
        else:
            return('MMYY')
    if is_mm(cand[2:]):
        return 'YYMM'
    return 'NA'


candidate = input()
print(judge(candidate))

Solution (Python):
S = input()

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

is_MM_A = 1 <= A <= 12
is_MM_B = 1 <= B <= 12

if is_MM_A and is_MM_B :
	print('AMBIGUOUS')
elif is_MM_A :
	print('MMYY')
elif is_MM_B :
	print('YYMM')
else :
	print('NA')

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

if S[0] != 0: a = int(''.join(S[:2]))
else: a = int(S[1])
if S[2] != 0: b = int(''.join(S[2:]))
else: b = int(S[3])

if 1 <= a <= 12:
    if 1 <= b <= 12:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if 1 <= b <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'

print(ans)

Solution (Python):
s = input()
first = 'MM'
second = 'MM'

if int(s[:2]) > 12 or int(s[:2]) == 0:
	first = 'YY'
	if int(s[2:]) == 0:
		first = 'NA'

if int(s[2:]) > 12 or int(s[2:]) == 0:
	second = 'YY'
	if int(s[:2]) == 0:
		second = 'NA'

if first == 'MM' and second == 'MM':
	print('AMBIGUOUS')
elif first == 'YY' and second == 'YY':
	print('NA')
elif first == 'NA' or second == 'NA':
	print('NA')
else:
	print(first+second)

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

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

Solution (Python):
import sys

stdin = sys.stdin

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

s = input()
f = int(s[:2])
b = int(s[2:])
flag1 = 0
flag2 = 0
if 0 <= f and f <= 99 and 1<= b and b<=12:
    flag1 = 1
if 0 <= b and b <= 99 and 1<= f and f<=12:
    flag2 = 1
if flag1 == 1 and flag2 == 1:
    print("AMBIGUOUS")
elif flag1 == 1:
    print("YYMM")
elif flag2 == 1:
    print("MMYY")
else:
    print("NA")

Solution (Python):
s = list(input())
left = int(''.join(s[:2]))
right = int(''.join(s[2:]))
lyy = False
lmm = False
ryy = False
rmm = False
if 0 <= left <= 99:
    lyy = True
    if 1<= left <= 12:
        lmm = True

if 0 <= right <= 99:
    ryy = True
    if 1<= right <= 12:
        rmm = True

if lyy and lmm and ryy and rmm:
    print('AMBIGUOUS')
elif lyy and rmm:
    print('YYMM')
elif lmm and ryy:
    print('MMYY')
else:
    print('NA')

Solution (Python):
def read():
    S = input().strip()
    return (S, )


def solve(S):
    isYYMM = False
    isMMYY = False
    if 1 <= int(S[0:2]) <= 12:
        isMMYY = True
    if 1 <= int(S[2:4]) <= 12:
        isYYMM = True
    if isMMYY and isYYMM:
        return 'AMBIGUOUS'
    elif isMMYY:
        return 'MMYY'
    elif isYYMM:
        return 'YYMM'
    else:
        return 'NA'


if __name__ == '__main__':
    inputs = read()
    print("%s" % solve(*inputs))

Solution (Python):
import numpy as np
import math

def is_month(month):
    if (month >= 1) and (month <= 12):
        return True
    else:
        return False

def is_yymm(one, two):
    if is_month(two):
        return True
    else:
        return False

def is_mmyy(one, two):
    if is_month(one):
        return True
    else:
        return False
def main():
    S = input()
    one = int(S[0:2])
    two = int(S[2: 4])
    if is_yymm(one, two) and is_mmyy(one, two):
        print("AMBIGUOUS")
    elif(is_yymm(one, two) and ~is_mmyy(one, two)):
        print("YYMM")
    elif(~is_yymm(one, two) and is_mmyy(one, two)):
        print("MMYY")
    else:
        print("NA")

if __name__ == '__main__':
    main()

Solution (Python):
S = input()
A = S[0]+S[1]
B = S[2]+S[3]
L = ['01','02','03','04','05','06','07','08','09','10','11','12']
if (A in L) and (B in L):
  print('AMBIGUOUS')
elif A not in L:
  if B not in L:
    print('NA')
  else:
    print('YYMM')
else:
  print('MMYY')

Solution (Python):

import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


S = read()[:-1]

flg1, flg2 = False, False

first = int(S[:2])
last = int(S[2:])


if 0 < first < 13:
    flg1 = True

if 0 < last < 13:
    flg2 = True

if flg1 and flg2:
    print('AMBIGUOUS')

if flg1 and not flg2:
    print('MMYY')

if flg2 and not flg1:
    print('YYMM')

if not flg2 and not flg1:
    print('NA')

Solution (Python):
s = input()

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

Solution (Python):
S = input()

before = False
after = False
if 0 < int(S[0:2]) <= 12:
    before = True

if 0 < int(S[2:4]) <= 12:
    after = True

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

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

Solution (Python):
from sys import exit

S = input()

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

mm_first = True

mm_second = True

if 1 <= first <= 12:
    mm_first = True
else:
    mm_first = False

if 1 <= second <= 12:
    mm_second = True
else:
    mm_second = False

if mm_first and mm_second:
    print('AMBIGUOUS')
elif mm_first and not mm_second:
    print('MMYY')
elif not mm_first and mm_second:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input().strip()
left = int(s[:2])
right = int(s[2:])
if (left == 0 or left > 12) and 1 <= right <= 12:
    print('YYMM')
elif 1 <= left <= 12 and (right == 0 or right > 12):
    print('MMYY')
elif 1 <= left <= 12 and 1 <= right <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):
def has_month_potential(num):
    return num >= 1 and num <= 12

S = input()

formar = int(S[:2])
latter = int(S[2:])

if has_month_potential(formar) and not has_month_potential(latter):
    print('MMYY')
elif not has_month_potential(formar) and has_month_potential(latter):
    print('YYMM')
elif has_month_potential(formar) and has_month_potential(latter):
    print('AMBIGUOUS')
elif not has_month_potential(formar) and not has_month_potential(latter):
    print('NA')

Solution (Python):
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsm = lambda: map(str, sys.stdin.readline().split())

s = ns()
lisy = [str(i).zfill(2) for i in range(0, 100)]
lism = [str(i).zfill(2) for i in range(1, 13)]

if str(s[:2]) in lisy and str(s[2:]) in lism:
    if str(s[:2]) in lism and str(s[2:]) in lisy:
        print('AMBIGUOUS')
        exit()
    else:
        print('YYMM')
        exit()
if str(s[:2]) in lism and str(s[2:]) in lisy:
    if str(s[:2]) in lisy and str(s[2:]) in lism:
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
print('NA')

Solution (Python):
s = input()

m_flag = [False, False]

if 1 <= int(s[:2]) <= 12:
    m_flag[0] = True

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

if m_flag[0] and m_flag[1]:
    print("AMBIGUOUS")

if m_flag[0] and not m_flag[1]:
    print("MMYY")

if not m_flag[0] and m_flag[1]:
    print("YYMM")

if not m_flag[0] and not m_flag[1]:
    print("NA")

Solution (Python):
s = input()
tuki = ('01','02','03','04','05','06','07','08','09','10','11','12')
mae = s[0] + s[1]
usiro = s[2] + s[3]
if mae in tuki and usiro in tuki:
        print('AMBIGUOUS')
elif mae in tuki:
        print('MMYY')
elif usiro in tuki:
        print('YYMM')
else:print('NA')