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.



Sample input:
1905


Sample output:
YYMM

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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 s1 == '00' or s2 == '00':
#     print('NA')
#     exit(0)
if ismm(s1):
    if ismm(s2):
        #両方MM
        print('AMBIGUOUS')
    else :
        #前だけMM
        print('MMYY')
else:
    if ismm(s2):
        #後ろだけMM
        print('YYMM')
    else :
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
# YYMM or MMYY or AMBIGUOUS or NA
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 = ""

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

#MMYY
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
#!/usr/bin/env python
s = input()
m_bit=0
y_bit=0
if int(s[:2]) <= 12 and int(s[:2]) >= 1:
	m_bit = 1 # MMYY is acceptable
if int(s[2:]) <= 12 and int(s[2:]) >= 1:
	y_bit = 1 #YYMM is acceptable
if m_bit and y_bit:
	print("AMBIGUOUS")
elif m_bit:
	print("MMYY")
elif y_bit:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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()

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
import queue

"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
#a = list(map(int, input().split()))
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)
#print(str(lst[0])+str(lst[1]))
#print(str(lst[2])+str(lst[3]))

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

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
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")

Submission status: Accepted

Solution code:
s = input()
pre = s[0:2]
post = s[2:]

pre = int(pre)
post = int(post)

if (13 > pre) and (pre > 0):
    s_pre = "M"
else:
    s_pre = "NM"

if (13 > post) and (post > 0):
    s_post = "M"
else:
    s_post = "NM"


# print(s_pre, s_post)

if s_pre == "M":
    if s_post == "NM":
        ans = "MMYY"
    else:
        ans = "AMBIGUOUS"
else:
    if s_post == "NM":
        ans = "NA"
    else:
        ans = "YYMM"
print(ans)

Submission status: Accepted

Solution code:
S= input()
u = int(S[:2])
l = int(S[2:])
YYMM = False
MMYY = False
if 1<=l<=12:
    YYMM = True
if 1<=u<=12:
    MMYY = True
if YYMM and MMYY:
    print("AMBIGUOUS")
elif YYMM:
    print("YYMM")
elif MMYY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S=int(input())

S1 = S // 100
S2 = S % 100

if S1 == 0:
    if S2 == 0 or S2 > 12:
        print('NA')
    else:
        print('YYMM')
elif S1 != 00 and S1 < 13:
    if S2 == 0 or S2 > 12:
        print('MMYY')
    else:
        print('AMBIGUOUS')
else:
    if S2 == 0 or S2 > 12:
        print('NA')
    else:
        print('YYMM')

Submission status: Accepted

Solution code:
s=input()

yy=int(s[:2])
mm=int(s[2:])

if yy <= 12 and mm <= 12 and yy != 0 and mm != 0:
    print('AMBIGUOUS')
elif mm <= 12 and mm != 0:
    print('YYMM')
elif yy <= 12 and yy != 0:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
def mcheck(m):
  if m >= 1 and m <= 12:
    return True
  else:
    return False

S = [int(x) for x in list(input())]
  
A = S[0] * 10 + S[1]
B = S[2] * 10 + S[3]

Acheck = mcheck(A)
Bcheck = mcheck(B)

result = 'NA'
if Acheck and Bcheck:
  result = 'AMBIGUOUS'
elif Acheck == True and Bcheck == False:
  result = 'MMYY'
elif Acheck == False and Bcheck == True:
  result = 'YYMM'
  
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a=int(s[0])*10+int(s[1])
b=int(s[2])*10+int(s[3])
pp=['NA','MMYY','YYMM','AMBIGUOUS']
c=0
if 1<=a<=12:
  c+=1
if 1<=b<=12:
  c+=2
print(pp[c])

Submission status: Accepted

Solution code:
S = input()
S1 = int(S[:2])
S2 = int(S[2:])

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

Submission status: Accepted

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

formar = S[0]+S[1]
latter = S[2]+S[3]

if int(formar) > 12 and int(latter) > 12:
    print("NA")
elif int(formar) <= 12 and int(latter) <= 12:
    if formar == "00" and not latter == "00":
        print("YYMM")
    elif latter == "00" and not formar == "00":
        print("MMYY")
    elif formar == "00" and latter == "00":
        print("NA")
    else:
        print("AMBIGUOUS")
elif int(formar) > 12:
    if latter == "00":
        print("NA")
    else:
        print("YYMM")
else:
    if formar == "00":
        print("NA")
    else:
        print("MMYY")

Submission status: Accepted

Solution code:
import re
list = re.split('(..)', input())[1::2]
a = int(list[0])
b = int(list[1])
if a>0 and a<=12 and b>=1 and b<=12:
    print("AMBIGUOUS")
elif a>12 and b>0 and b<=12:
    print("YYMM")
elif a==0 and b>0 and b<=12:
    print("YYMM")
elif a<=12 and a>0 and b>12:
    print("MMYY")
elif a<=12 and a>0 and b==0:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
le = int(S[0:2])
ri = int(S[2:4])
if (le == 0 and ri == 0) or (le == 0 and ri > 12) or (le > 12 and ri == 0) or (le>12 and ri>12):
  print("NA")
elif 0 < le <= 12 and 0 < ri <= 12:
  print("AMBIGUOUS")
elif 0 < le <= 12 and ( ri == 0 or ri >12 ):
  print("MMYY")
elif 0 < ri <= 12 and ( le == 0 or le >12 ):
  print("YYMM")

Submission status: Accepted

Solution code:
s = list(input())

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

Submission status: Accepted

Solution code:
f = "YYMM"
s = "MMYY"


st = input()

mm = int(st[:2])
yy = int(st[2:])



if (mm > 0 and mm < 13) and (yy > 0 and yy < 13):
    print("AMBIGUOUS")

elif (yy > 0 and yy < 13) and ( mm < 1 or mm > 12):
    print(f)
    
elif (yy < 1 or yy > 12) and ( mm > 0 and mm < 13):
    print(s)
else:
    print("NA")

Submission status: Accepted

Solution code:
X1 = list(map(str, input().split()))

X2 = X1[0]

mae = int(X2[0:2])
ushiro = int(X2[2:4])

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

Submission status: Accepted

Solution code:
s = input()
u = int(s[0] + s[1])
l = int(s[2] + s[3])

if l == 0 or u == 0:
    if 0 < l and l < 13:
        print('YYMM')

    elif 0 < u and u < 13:
        print("MMYY")
    else:
        print('NA')

elif 0 < l and l < 13:

    if 0 < u and u < 13:
        print('AMBIGUOUS')
    else:
        print("YYMM")

elif 0 < u and u < 13:
    print("MMYY")
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

f2 = int(s[:2])
b2 = int(s[2:])

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

Submission status: Accepted

Solution code:
s = input()
if (s[0] == "0" and s[1] != "0") or (s[0] == "1" and s[1] == "0") or (s[0] == "1" and s[1] == "1") or (s[0] == "1" and s[1] == "2"):
  if (s[2] == "0" and s[3] != "0") or (s[2] == "1" and s[3] == "0") or (s[2] == "1" and s[3] == "1") or (s[2] == "1" and s[3] == "2"):
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if (s[2] == "0" and s[3] != "0") or (s[2] == "1" and s[3] == "0") or (s[2] == "1" and s[3] == "1") or (s[2] == "1" and s[3] == "2"):
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S=input()
aa=int(S[0])
a=int(S[1])
bb=int(S[2])
b=int(S[3])
a=a+aa*10
b=b+bb*10
if 0<a<13 and 0<b<13:
  print("AMBIGUOUS")
elif a==0 or a>12:
  if b==0 or b>12:
    print("NA")
  else:
    print("YYMM")
elif b==0 or b>12:
  if a==0 or a>12:
    print("NA")
  else:
    print("MMYY")

Submission status: Accepted

Solution code:
s = raw_input()

x = int(s[0:2])
y = int(s[2:])

yymm = 0
mmyy = 0

if y > 0 and y <= 12:
    yymm = 1

if x > 0 and x <= 12:
    mmyy = 1

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

Submission status: Accepted

Solution code:
s = input()
is_yy = lambda x: 0 <= int(x) <= 99
is_mm = lambda x: 1 <= int(x) <= 12

yymm = False
mmyy = False

a = is_yy(s[:2])
b = is_mm(s[2:])

if a and b:
    yymm = True

a = is_mm(s[:2])
b = is_yy(s[2:])

if a and b:
    mmyy = True

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

Submission status: Accepted

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

# YYMM
f1 = 1 <= b <= 12

# MMYY
f2 = 1 <= a <= 12

if f1 and f2:
    print('AMBIGUOUS')
elif f1:
    print('YYMM')
elif f2:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
import datetime
S = input()

def YYMM(S):
	try:
		datetime.datetime.strptime(S,"%y%m")
		return True
	except ValueError:
		return False

def MMYY(S):
	try:
		datetime.datetime.strptime(S,"%m%y")
		return True
	except ValueError:
		return False

YM = YYMM(S)
MY = MMYY(S)

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

Submission status: Accepted

Solution code:
S = list(input())

left =  ''.join(S[0:2])
right = ''.join(S[2:4])


left_flag = 0
right_flag = 0
if int(left) <= 12 and left != '00':
    left_flag = 1

if int(right) <= 12 and right != '00':
    right_flag = 1


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

Submission status: Accepted

Solution code:
S = list(input())
S_1 = int("".join(S[0:2]))
S_2 = int("".join(S[2:4]))



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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

def if_YYMM(text):
    yy = int(text[0:2])
    mm = int(text[2:4])
    
    if mm < 1 or mm > 12:
        return False
    
    return True

def if_MMYY(text):
    mm = int(text[0:2])
    yy = int(text[2:4])
    
    if mm < 1 or mm > 12:
        return False
    
    return True

text = input()

mmyy = if_MMYY(text)
yymm = if_YYMM(text)

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

Submission status: Accepted

Solution code:
inputdata = input()
up = int(inputdata[0:2])
down = int(inputdata[2:4])
if 0 < up <= 12:
  if 0 < down <=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 0 < down <= 12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

flg1 = False
flg2 = False

if x >= 1 and x <= 12:
    flg1 = True

if y >= 1 and y <= 12:
    flg2 = True

if flg1 == True and flg2 == True:
    print('AMBIGUOUS')

elif flg1 == False and flg2 == True:
    print('YYMM')

elif flg1 == True and flg2 == False:
    print('MMYY')

else:
    print('NA')

Submission status: Accepted

Solution code:
s=list(input())
s=list(map(int,s))
t=10*s[0]+s[1]
k=10*s[2]+s[3]
if 1<=t<=12:
  if 1<=k<=12:
    print("AMBIGUOUS")
  else:
    print("MMYY")
elif 1<=k<=12:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

s = input().rstrip()

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

isyymm = True if (0 <= int(front) <= 99 and 1 <= int(back) <= 12) else False
ismmyy = True if (0 <= int(back) <= 99 and 1 <= int(front) <= 12) else False

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    first = int(S[:2])
    latter = int(S[2:])
    yymm = True
    mmyy = True
    if first > 12 or first == 0:
        mmyy = False
    if latter > 12 or latter == 0:
        yymm = False
    if mmyy and yymm:
        print("AMBIGUOUS")
    elif mmyy:
        print("MMYY")
    elif yymm:
        print("YYMM")
    else:
        print("NA")
main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


S = input()

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

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

Submission status: Accepted

Solution code:
def MMcheck(MM):
    if 1 <= MM and MM <= 12:
        return 1
    else:
        return 0
S = input()
s = list(S)
#mae
#print(s[0:2])
mae = int("".join(s[0:2]))
#print(mae)
countmae = MMcheck(mae)
#print(s[2:4])
ushiro = int("".join(s[2:4]))
#print(ushiro)
countushiro = MMcheck(ushiro)

if countmae == 1 and countushiro == 1:
    print("AMBIGUOUS")
elif countmae == 0 and countushiro == 1:
    print("YYMM")
elif countmae == 1 and countushiro == 0:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
def m(ss):
    if ss > 0 and ss <= 12:
        return 1
    return 0

s = list(input())
s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])
#print(s1,s2)
if m(s1) and m(s2):
    print("AMBIGUOUS")
elif m(s1) and not(m(s2)):
    print("MMYY")
elif not(m(s1)) and m(s2):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
a, b = int(s[:2]), int(s[2:])
if a >= 13 and a <= 99 or a == 00:
    if b >= 1 and b <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if b >= 1 and b <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

Submission status: Accepted

Solution code:
s = input()
m2 = int(s[0] + s[1])
u2 = int(s[2] + s[3])

YM = False
MY = False

if m2 < 13 and m2 != 0:
  MY = True
if u2 < 13 and u2 != 0:
  YM = True
if (m2 == 0 and u2 >12) or (u2 == 0 and m2 >12) or (m2 == 0 and u2 == 0):
  YM = False
  MY = False
  
if YM == False and MY == True:
  print('MMYY')
elif MY == False and YM == True:
  print('YYMM')
elif YM == MY == False:
  print('NA')
else:
  print('AMBIGUOUS')

Submission status: Accepted

Solution code:
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')

Submission status: Accepted

Solution code:
S = input()
LEFT= int(S[:2])
RIGHT = int(S[2:])

left_m = False
right_m = False

if 1 <= LEFT <= 12:
    left_m = True
    
if 1<= RIGHT <= 12:
    right_m = True

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

Submission status: Accepted

Solution code:
S = input()
a = int(S[0:2])
b = int(S[2:4])
ans = ''

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

print(ans)

Submission status: Accepted

Solution code:
s = input()

p1 = s[0:2]
p2 = s[2:4]

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

if (p1 not in m and p2 in m):
	print("YYMM")
elif (p1 in m and p2 in m):
	print("AMBIGUOUS")
elif (p1 not in m and p2 not in m):
	print("NA")
else:
	print("MMYY")

Submission status: Accepted

Solution code:
S = input()

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

def is_month(ss):
    if ss > 0 and ss <= 12:
        return True
    else:
        return False

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

Submission status: Accepted

Solution code:
S = int(input())

simo = S%100
kami = S//100

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

Submission status: Accepted

Solution code:
a = input()
q, mod =divmod(int(a), 100)
if q == 0 :
  if mod < 13 and mod != 0:
    print("YYMM")
  else : print("NA")
elif mod == 0 :
  if q < 13 and q != 0:
    print("MMYY")
  else : print("NA")
elif q < 13 :
  if mod < 13 :
    print("AMBIGUOUS")
  else : print("MMYY")
else:
  if mod < 13 :
    print("YYMM")
  else : print("NA")