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:
text = input()
a = text[:2]
b = text[2:]
m = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12']
if a in m:
    if b in m:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if b in m:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
def resolve():
    S = input()

    # YY: 00<=YY<=99
    # MM: 01<=MM<=12
    
    f_canYY = lambda x: '00' <= x and x <= '99'
    f_canMM = lambda x: '01' <= x and x <= '12'

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

    yymm = f_canYY(a) and f_canMM(b)
    mmyy = f_canMM(a) and f_canYY(b)

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

Submission status: Accepted

Solution code:
S=list(input())
a=int("".join(S[0:2]))
b=int("".join(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:
S=input()
ans=[0]*2#YYMM,MMYY
if 0<int(S[:2])<13:#MMYY
    ans[1]=1
if 0<int(S[2:])<13:#YYMM
    ans[0]=1
if  ans==[1,1]:
    print('AMBIGUOUS')
elif ans==[0,0]:
    print('NA')
elif ans==[1,0]:
    print('YYMM')
else:
    print('MMYY')

Submission status: Accepted

Solution code:
S = input()
F = int(S[0:2])
B = int(S[2:4])

if 0 < F and F < 13:
    if 0 < B and B < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < B and B < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
a,b = int(S[:2]), int(S[2:])
ans = ['NA', 'YYMM', 'MMYY', 'AMBIGUOUS']
idx = 0
if a in range(1,13):
  idx += 2
if b in range(1,13):
  idx += 1
print(ans[idx])

Submission status: Accepted

Solution code:
S = input()
A = int(S[:2])
B = int(S[2:])
f1 = 1 <= A <= 12
f2 = 1 <= B <= 12
if f1 and f2:
    print('AMBIGUOUS')
elif f1:
    print('MMYY')
elif f2:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

a = 1 <= pre and pre <= 12
b = 1 <= post and post <= 12

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

Submission status: Accepted

Solution code:
S = input()

head = S[:2]
tail = S[2:]

s = [head, tail]
i = [int(si) for si in s]
MM = [True, True]

for j in range(2):
    if i[j] > 12:
        MM[j] = False
    if i[j] < 1:
        MM[j] = False

if MM[0] is True and MM[1] is False:
    print('MMYY')
elif MM[0] is False and MM[1] is True:
    print('YYMM')
elif MM[0] is True and MM[1] is True:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
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')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

# coding: utf-8

# In[5]:

import sys
input = sys.stdin.readline
#N, K = map(int, input().split())
S = input()


# In[6]:

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


# In[ ]:

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

## yymm
if 1 <= b and b <= 12:
  yymm = 1
else:
  yymm = 0
  
## mmyy
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#a=list(map(int,input().split(" ")))
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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:



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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding:utf-8
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:]
#print (early,late)
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")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#	!/usr/bin/env python3
#	encoding: UTF-8
#	Modified: <19/May/2019 05:45:09 PM>


#	✪ H4WK3yE乡
#	Mohd. Farhan Tahir
#	Indian Institute Of Information Technology (IIIT), Gwalior


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

Submission status: Accepted

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

#print(f_flg, l_flg)
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')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(input())
#print(s)
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')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
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')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s=list(input())
YYMM=False
MMYY=False
#if YYMM
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')

Submission status: Accepted

Solution code:
# coding: utf-8


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

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

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

Submission status: Accepted

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

Submission status: Accepted

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