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:
s=input()
a=int(s[:2])
b=int(s[2:])

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

Submission status: Accepted

Solution code:
s = input()

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


def check_type(val):
    if 1 <= val <= 12:
        return 'm'
    else:
        return 'y'


r_front = check_type(front)
r_back = check_type(back)

if r_front == 'y' and r_back == 'm':
    print('YYMM')
elif r_front == 'm' and r_back == 'y':
    print('MMYY')
elif r_front == 'm' and r_back == 'm':
    print('AMBIGUOUS ')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()

before, after = int(S[:2]), int(S[2:])

if 0 < before and before <= 12 and 0 < after and after <= 12:
	print('AMBIGUOUS')
elif (before > 12 or before == 0) and 0 < after and after <= 12:
	print('YYMM')
elif 0 < before and before <= 12 and (12 < after or after == 0):
	print('MMYY')
else:
	print('NA')

Submission status: Accepted

Solution code:
s = input()

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

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()
if 1<=int(S[0:2])<=12:
    if 1<=int(S[2:4])<=12:print("AMBIGUOUS")
    else:print("MMYY")
else:
    if 1<=int(S[2:4])<=12:print("YYMM")
    else:print("NA")

Submission status: Accepted

Solution code:

def Mcheck(n):
    if(0<n<13):
        return 0
    else:
        return 1
    

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

if(Mcheck(f)==0):
    if(Mcheck(s)==0):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(Mcheck(s)==0):
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

month_flg0 = True
month_flg1 = True

if (S[:2] > '12' or S[:2] < '01'):
    month_flg0 = False

if (S[2:] > '12' or S[2:] < '01'):
    month_flg1 = False

if month_flg0 and month_flg1:
    print('AMBIGUOUS')
elif not(month_flg0) and not(month_flg1):
    print('NA')
elif month_flg0:
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:

S = input()

MAE = int(S[:2])
USIRO = int(S[2:])

MMYY_Flag = False
YYMM_Flag = False


if 1 <= MAE and 12 >= MAE:
    MMYY_Flag = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()

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

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

Submission status: Accepted

Solution code:
S = int(input())
l = int(S/100)
r = int(S%100)
YYMM = bool(1 <= r <= 12)
MMYY = bool(1 <= l <= 12)

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

Submission status: Accepted

Solution code:
S = int(input())
l = int(S/100)
r = int(S%100)

if 1 <= r <= 12:
  if 1 <= l <= 12:
    print('AMBIGUOUS')
  else:
    print('YYMM')
else:
  if 1 <= l <= 12:
    print('MMYY')
  else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
#print(S)

mae = int(S[:2])
ato = int(S[2:])
#print(mae, ato)

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

Submission status: Accepted

Solution code:
s = input()
forward = int(s[:2])
backward = int(s[2:])

fb = [forward, backward]

flag12 = [False, False]
flag0 = [False, False]

for i in range(2):
    if fb[i] > 12:
        flag12[i] = True
    if fb[i] == 0:
        flag0[i] = True

# 前半部分は何が来ても良い。後半にくるものが面倒
if backward > 12 or backward == 0:
    if forward > 12 or forward == 0:
        print("NA")
    else:
        print("MMYY")
elif forward > 12 or forward == 0:
    if backward > 12 or backward == 0:
        print("NA")
    else:
        print("YYMM")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
N = input()
n = [int(N[:2]), int(N[2:])]
a = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']
if n[0] > 12 or n[0] == 0:
  del a[1]
  del a[1]
  if n[1] > 12 or n[1] == 0:
    del a[0]
elif n[1] > 12 or n[1] == 0:
  del a[0]
  del a[1]
else:
  a = [a[2]]
print(a[0])

Submission status: Accepted

Solution code:
from datetime import datetime as dt

def main():
    S = input()
    isYYMM = False
    isMMYY = False
    try:
        dt.strptime(S, '%y%m')
        isYYMM = True
    except ValueError:
        pass
    try:
        dt.strptime(S, '%m%y')
        isMMYY = True
    except ValueError:
        pass

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


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=a%100
a=a//100
print(("AMBIGUOUS"if 0<b<13else"MMYY")if 0<a<13else"YYMM"if 0<b<13else"NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
lst = list(s)

first =list(map(int, lst[:2]))
last = list(map(int, lst[2:]))

f_num = first[0]*10 + first[1]
s_num = last[0]*10 + last[1]

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

Submission status: Accepted

Solution code:
c = input()
f = int(c[:2])
e = int(c[2:]) 

if (0<f<13) and (0<e<13):
    print("AMBIGUOUS")
elif (0<f<13):
    print("MMYY")
elif(0<e<13):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
formerh = int(s[0:2])
latterh = int(s[2:4])


if (formerh > 12 or formerh == 0) and (latterh > 12 or latterh == 0):
  print('NA')
elif (formerh > 12 or formerh == 0):
  print('YYMM')
elif (latterh > 12 or latterh == 0):
  print('MMYY')
else: 
  print('AMBIGUOUS')

Submission status: Accepted

Solution code:
def checkMM(i):
    if i >= 1 and i <= 12:
        result = 1
    else:
        result = 0
    return result

def checkYY(i):
    if i >= 0 and i <= 99:
        result = 1
    else:
        result = 0
    return result


s = input()

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

result = 'NA'

if checkMM(s1) and checkYY(s2):
    result = 'MMYY'


if checkYY(s1) and checkMM(s2):
    if result == 'MMYY':
        result = 'AMBIGUOUS'
    else:
        result = 'YYMM'

print(result)

Submission status: Accepted

Solution code:
S=int(input())
S1=S//100
S2=S%100
if 1<=S1<=12:
    m1=1
else:
    m1=0
if 1<=S2<=12:
    m2=1
else:
    m2=0
if m1==0 and m2==0:
    print("NA")
elif m1==0 and m2==1:
    print("YYMM")
elif m1==1 and m2==0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S=str(input())
month=["01","02","03","04","05","06","07","08","09","10","11","12"]
A=S[0:2]
B=S[2:]

if(A in month and B in month):
    print("AMBIGUOUS")
elif(A in month and B not in month):
    print("MMYY")
elif(A not in month and B in month):
    print("YYMM")
elif(A not in month and B not in month):
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

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

if S1 in MM and S2 in MM:
    print("AMBIGUOUS")
elif S1 in MM:
    print("MMYY")
elif S2 in MM:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()

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

Submission status: Accepted

Solution code:
S = input()

ZEN = int(S[:2])
KOU = int(S[2:])
MM = list(range(1,13))
YY = list(range(100))



if ZEN in MM and KOU in MM:
    print("AMBIGUOUS")
elif ZEN in MM and KOU in YY:
    print("MMYY")
elif ZEN in YY and KOU in MM:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=input()
A=int(s[:2])
B=int(s[2:])
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()
A = S[0]+S[1]
B = S[2]+S[3]
A = int(A)
B = int(B)
if (A >= 1) & (A <=12 ) & (B >= 1) & (B <= 12):
    print("AMBIGUOUS")
elif (A >= 1) & (A <= 12) & (B >= 13) & (B <= 99):
    print("MMYY")
elif (A >= 1) & (A <= 12) & (B == 0):
    print("MMYY")
elif (A >= 13) & (A <= 99) & (B >= 1) & (B <= 12):
    print("YYMM")
elif (A == 0) & (B >= 1) & (B <= 12):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

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

fa, fb = False, False
if a in range(1, 13):
    fa = True

if b in range(1, 13):
    fb = True

if fa and fb:
    print('AMBIGUOUS')
elif fa and not fb:
    print('MMYY')
elif not fa and fb:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
a = int(s[:2])
b = int(s[2:])
f_yymm = False
f_mmyy = False

if 1 <= a <= 12:
  f_mmyy = True
if 1 <= b <= 12:
  f_yymm = True
    
if f_yymm and f_mmyy:
  print("AMBIGUOUS")
elif f_yymm and (not f_mmyy):
  print("YYMM")
elif (not f_yymm) and f_mmyy:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:
a = list(input())
 
A = a[0]+a[1]
B = a[2]+a[3]
 
if A == "00" or int(A) > 12:
  if B == "00" or int(B) > 12:
    print("NA")
  else:
    print("YYMM")
else:
  if B == "00" or int(B) > 12:
    print("MMYY")
  else:
    print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def ismonth(a):
    return 0 < a < 13
# 入力の受け取り
s = input()

#前後2つに分ける
a, b = int(s[:2]), int(s[2:])
if ismonth(a) and ismonth(b):
    print('AMBIGUOUS')
elif ismonth(a):
    print('MMYY')
elif ismonth(b):
    print('YYMM')
else:
     print('NA')

Submission status: Accepted

Solution code:
def m(s):
    if 1 <= int(s) and int(s) <= 12:
        return True
    return False

S = input()
c1 = S[:2]
c2 = S[-2:]

if m(c1) and m(c2):
    ans = 'AMBIGUOUS'
elif m(c1):
    ans = 'MMYY'
elif m(c2):
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
input_str = input()[:4]
head = int(input_str[:2])
foot = int(input_str[2:4])

if head > 12 or head == 0:
    if foot <= 12 and foot > 0:
        print('YYMM')
    else:
        print('NA')
elif head > 0:
    if foot > 12 or foot == 0:
        print('MMYY')
    elif foot <= 12:
        print('AMBIGUOUS')
    else:
        print('NA')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
flag1 = True
flag2 = True
num = int(S)

if S.startswith("00"):
    flag1 = False
elif num // 100 > 12:
    flag1 = False
if S.endswith("00"):
    flag2 = False
elif num % 100 > 12:
    flag2 = False
    
if flag1 == True and flag2 == True:
    print("AMBIGUOUS")
elif flag1 == False and flag2 == False:
    print("NA")
elif flag1 == False:
    print("YYMM")
else:
    print("MMYY")

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
s = list(input())
s = [int(i) for i in s]

former = s[0] * 10 + s[1]
latter = s[2] * 10 + s[3]

formflg = 0
lattflg = 0


if former <= 12 and former != 0:
	formflg = 1
	
if latter <= 12 and latter != 0:
	lattflg = 1
	

if formflg + lattflg == 0:
	print("NA")
elif formflg + lattflg == 2:
	print("AMBIGUOUS")
elif formflg == 1:
	print("MMYY")
elif lattflg == 1:
	print("YYMM")

Submission status: Accepted

Solution code:
S = input()

UP = int(S) // 100
DN = int(S) % 100
if UP > 0 and UP < 13 and DN > 0 and DN < 13:
    print("AMBIGUOUS")
elif UP > 0 and UP < 13:
    print("MMYY")
elif DN > 0 and DN < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:

def yymm(s):
    if 1 <= int(s[2:4]) <= 12:
        return True
    else:
        return False
def mmyy(s):
    if 1<=int(s[:2]) <=12:
        return True
    else:
        return False
s = input()
if mmyy(s) and yymm(s):
    print("AMBIGUOUS")
elif mmyy(s):
    print("MMYY")
elif yymm(s):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
n = list(input())
a,b = int(n[0]+n[1]),int(n[2]+n[3])
if (a==0 or a>12) and (b==0 or b>12):
  print("NA")
elif 1<=a<=12 and (b>12 or b==0):
  print("MMYY")
elif 1<=b<=12 and (a>12 or a==0):
  print("YYMM")
else:
  print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s = int(input())
 
a = int(s / 100) #百の位と千の位
b = s - a*100 #下二桁
 
if a > 12:
  if b > 12 or b == 0:
    print("NA")
  else:
    print("YYMM")
elif a == 0:
  if b < 13 and b > 0:
    print("YYMM")
  else:
    print("NA")
elif b > 12 or b == 0:
  print("MMYY")
else:
  print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()
fst, snd = S[:2], S[2:]

def isMonth(s):
    return 1 <= int(s) <= 12

table = {
    (False, True):  'YYMM',
    (True,  False): 'MMYY',
    (True,  True):  'AMBIGUOUS',
    (False, False): 'NA'
}
print(table[(isMonth(fst), isMonth(snd))])

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")
elif a>12 or a==0:
    print("YYMM")
elif b>12 or b==0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
n=input()
a=int(str(n[0]+n[1]))
b=int(str(n[2]+n[3]))
if 0<a<=12:
    if b>12 or b==0: 
        print("MMYY")
    else:
        print("AMBIGUOUS")
else:
    if 0<b<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
p = int(s[:2])
a = int(s[2:])

if 0 < p < 13 and 0 < a < 13:
    print("AMBIGUOUS")
elif 0 < p < 13 and 0 <= a < 100:
    print("MMYY")
elif 0 <= p < 100 and 0 < a < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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


if (
    int(s1) > 12
    and int(s2) > 12
    or int(s1) == 0
    and int(s2) == 0
    or int(s1) == 0
    and int(s2) > 12
    or int(s1) > 12
    and int(s2) == 0
):
    print("NA")

elif 1 <= int(s1) <= 12 and (int(s2) > 12 or int(s2) == 0):
    print("MMYY")

elif 1 <= int(s2) <= 12 and (int(s1) > 12 or int(s1) == 0):
    print("YYMM")

else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
def solve(s):
    x, y = s[:2], s[2:]
    mm = ["%02d" % i for i in range(1,13)]
    if (x in mm) and (y in mm):
        return "AMBIGUOUS"
    if x in mm:
        return "MMYY"
    if y in mm:
        return "YYMM"
    return "NA"

s = input()
print(solve(s))

Submission status: Accepted

Solution code:
S = int(input())
Front = int(S / 100)
Back = S % 100

MMYY = False
YYMM = False

if 1 <= Front and Front <= 12:
  MMYY = True

if 1 <= Back and 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=input()
fst = int(s[:2])
snd = int(s[2:])
if 0<fst and fst<13:
    if 0<snd and snd<13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0<snd and snd<13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()

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

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

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

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

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

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

else:
    print('NA')

Submission status: Accepted

Solution code:
import sys
rr = lambda: sys.stdin.readline().strip()
ri = lambda: int(rr())
rs = lambda: [int(_) for _ in rr().split()]

S = rr()

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

Submission status: Accepted

Solution code:
s = input()
fir = int(s[:2])
sec = int(s[2:])
b = (1<=fir<=12)
c = (1<=sec<=12)
if b and c:
  t = "AMBIGUOUS"
elif b:
  t = "MMYY"
elif c:
  t = "YYMM"
else:
  t = "NA"
print(t)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
str = list(input())

m = False
a = False

mae = int(str[0])*10 + int(str[1])
ato = int(str[2])*10 + int(str[3])

if mae > 0 and mae < 13:
    m = True

if ato > 0 and ato < 13:
    a = True

if m and a:
    print("AMBIGUOUS")
elif m!= True and a:
    print("YYMM")
elif m and a != True:
    print("MMYY")
elif m != True and a != True:
    print("NA")

Submission status: Accepted

Solution code:
def main(year, month):
    if (month == 0 or month > 12) and (year == 0 or year > 12):
        print("NA")
        return
    if month == 0 or month > 12:
        print("MMYY")
        return
    if year == 0 or year > 12:
        print("YYMM")
        return
    print("AMBIGUOUS")


input_str = input()
year, month = int(input_str[:2]), int(input_str[2:])

main(year, month)

Submission status: Accepted

Solution code:
def main():
    s=int(input())
    h=s//100
    t=s%100
    yymm=False
    mmyy=False
    if 1<=t<=12:
        yymm=True
    if 1<=h<=12:
        mmyy=True
    if yymm == True and mmyy == True:
        print('AMBIGUOUS')
    elif yymm == mmyy:
        print('NA')
    elif yymm == True:
        print('YYMM')
    else:
        print('MMYY')

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s=input()
fo=s[0:2]
la=s[2:]
n=int(fo)
m=int(la)
a=(n<13) and (n>0)
b=(m<13) and (m>0)
ans='NA'
if a and b:
  ans='AMBIGUOUS'
elif a and not b:
  ans='MMYY'
elif not a and b:
  ans='YYMM'
else:
  ans='NA'
print(ans)

Submission status: Accepted

Solution code:
import sys

s=input()

chars2=[int(s[i: i+2])for i in range(0,len(s),2)]

if (chars2[0]>0 and  chars2[0]<13):
    if (chars2[1]>0 and  chars2[1]<13):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if (chars2[1]>0 and  chars2[1]<13):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
YY = int(s[:2]) 
MM = int(s[2:])

if 0 < YY < 13 and 0 < MM < 13:
    print("AMBIGUOUS")
elif 0 < YY < 13:
    print("MMYY")
elif 0 < MM < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

def solve(S):
    check1 = 1 <= int(S[0:2]) <= 12
    check2 = 1 <= int(S[2:4]) <= 12
    return {
        (False, False): "NA",
        (False, True):  "YYMM",
        (True,  False): "MMYY",
        (True,  True):  "AMBIGUOUS",
    }[(check1, check2)]

print(solve(S))

Submission status: Accepted

Solution code:
S=input()
h=S[:2]
t=S[2:]
if S[0]!='0':
    h=int(h)
else:
    h=int(S[1])
if S[2]!='0':
    t=int(t)
else:
    t=int(S[3])
if (h>12 or h==0) and (t>12 or t==0):
    print('NA')
elif (h>12 or h==0) and t<=12:
    print('YYMM')
elif h<=12 and (t>12 or t==0):
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()
YY = int(S[:2])
MM = int(S[2:])

if 0 < YY < 13 and 0 < MM < 13:
    print("AMBIGUOUS")

elif 0 < YY < 13:
    print("MMYY")

elif 0 < MM < 13:
    print("YYMM")
    
else:
    print("NA")

Submission status: Accepted

Solution code:
from sys import stdin
s = stdin.readline().rstrip()
bef = s[:2]
aft = s[2:]

if bef == '00':
    if aft == '00':
        print('NA')
    elif int(aft) > 0 and int(aft) < 13:
        print('YYMM')
    else:
        print('NA')
elif int(bef) > 0 and int(bef) < 13:
    if aft == '00':
        print('MMYY')
    elif int(aft) > 0 and int(aft) < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if aft == '00':
        print('NA')
    elif int(aft) > 0 and int(aft) < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
l = int(s[0:2])
r = int(s[2:4])
yymm = False
mmyy = False

if 0 < l and l < 13:
    mmyy = True
if 0 < r and r < 13:
    yymm = True

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

Submission status: Accepted

Solution code:
def monthable(n):
    n = int(n)
    if n <= 12 and n >= 1:
        return True
    else:
        return False

s = input()
s1,s2 = s[:2], s[2:]

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

Submission status: Accepted

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

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 = int(S[:2])
b = int(S[2:])
if 0 < a <= 12:
    if 0 < b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < b <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
data=str(input())
one=int(data[:2])
two=int(data[2:])
if 0<one<13 and 0<two<13:
  print("AMBIGUOUS")
elif 0<one<13:
  print("MMYY")
elif 0<two<13:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
def month(tuki):
    return 0 < tuki <= 12


s = input()
mae = int(s[:2])
ushiro = int(s[-2:])
p = ( "AMBIGUOUS" if month(mae) and month(ushiro) else
      "MMYY" if month(mae) else
      "YYMM" if month(ushiro) else
      "NA")
print(p)

Submission status: Accepted

Solution code:
inputS = input()
s = inputS

def month(tuki):
    return 0 < tuki <= 12 

mae = int(s[:2])
ushiro = int(s[-2:])

if month(mae) and month(ushiro):
    print("AMBIGUOUS")
elif month(mae):
    print("MMYY")
elif month(ushiro):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

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

checkMY = 0
checkYM = 0
if front >= 1 and front <= 12:
    checkMY = 1

if back >= 1 and back <= 12:
    checkYM = 1


if checkMY == 1:
    if checkYM == 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if checkYM == 1:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = raw_input()
first = int(s[0:2])
second = int(s[2:])
if 1 <= first <= 12 and 1 <= second <= 12:
	print "AMBIGUOUS"
elif 1 <= first <= 12:
	print "MMYY"
elif 1 <= second <= 12:
	print "YYMM"
else:
	print "NA"

Submission status: Accepted

Solution code:
S = int(input())
if (S // 100 > 12 or S // 100 == 0) and (S % 100 > 12 or S % 100 == 0):
  print('NA')
elif (S // 100 > 12 or S // 100 == 0) and 1 <= S % 100 <= 12:
  print('YYMM')
elif 1 <= S // 100 <= 12 and (S % 100 > 12 or S % 100 == 0):
  print('MMYY')
else:
  print('AMBIGUOUS')

Submission status: Accepted

Solution code:
s = int(input())

x = s // 100
y = s % 100

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s1 = int(s[:2])
s2 = int(s[2:])

if(s1>=1 and s1<=12):
  if(s2>=1 and s2<=12):
    print("AMBIGUOUS\n")
  else:
    print("MMYY\n")
else:
  if(s2>=1 and s2<=12):
    print("YYMM\n")
  else:
    print("NA\n")

Submission status: Accepted

Solution code:
s = input()

s11 = int(s[0:2])
s12 = int(s[2:5])

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

Submission status: Accepted

Solution code:
s = input()
ans = ""
a = int(s[0]+s[1])
b = int(s[2]+s[3])

if a == 0 and b == 0:
    ans = "NA"
elif a > 12 and b == 0:
    ans = "NA"
elif a == 0 and b > 12:
    ans = "NA"
elif a > 12 and b > 12:
    ans = "NA"
elif a > 12 and b < 13 and b != 0:
    ans = "YYMM"
elif a < 13 and b > 12 and a != 0:
    ans = "MMYY"
elif a == 0 and b < 13:
    ans = "YYMM"
elif a < 13 and b == 0:
    ans = "MMYY"
else:
    ans = "AMBIGUOUS"

print(ans)

Submission status: Accepted

Solution code:
S = input()
if int(S[:2]) > 0 and int(S[:2]) < 13:
    if int(S[2:]) > 0 and int(S[2:]) < 13:
        print('AMBIGUOUS')

    else:
        print('MMYY')

else:
    if int(S[2:]) > 0 and int(S[2:]) < 13:
        print('YYMM')

    else:
        print('NA')

Submission status: Accepted

Solution code:
#abc126b

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

Submission status: Accepted

Solution code:
S= input()
x = int(S[0:2])
y = int(S[2:])

mmyy = False
yymm = False
if 0 < x and x < 13:
    mmyy = True
if 0 < y and y < 13:
    yymm = 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()

fr_half = int(S[0:2]) 
se_half = int(S[2::])

if se_half > 0 and se_half <= 12:
  if fr_half  > 0 and fr_half <= 12:
    print('AMBIGUOUS')
  else:
    print('YYMM')
else:
  if fr_half  > 0 and fr_half <= 12:
    print('MMYY')
  else:
   	print('NA')

Submission status: Accepted

Solution code:
n = list(input())
head = int(n[0]+n[1])
tail = int(n[2]+n[3])
if (12 < head <=99 or head==0) and 0< tail <= 12 :
	print("YYMM")
elif 0<head<=12 and (12<tail<=99 or tail==0):
	print("MMYY")
elif 0<head<=12 and 0<=tail<=12 :
	print("AMBIGUOUS")
else :
	print("NA")

Submission status: Accepted

Solution code:
import sys

S = input()

f_yymm = 0
f_mmyy = 0

l = int(S[0] + S[1])
r = int(S[2] + S[3])

if l <= 12 and l > 0:
	f_mmyy = 1
if r <= 12 and r > 0:
	f_yymm = 1

if f_mmyy + f_yymm == 2:
	print("AMBIGUOUS")
elif f_mmyy == 1:
	print("MMYY")
elif f_yymm == 1:
	print("YYMM")
else:
	print("NA")

Submission status: Accepted

Solution code:
S = input()
L1 = S[:2]
L2 = S[2:]

if (1<=int(L1)<=12)&(1<=int(L2)<=12):
    print("AMBIGUOUS")
elif (1<=int(L2)<=12):
    print("YYMM")
elif (1<=int(L1)<=12):
    print("MMYY")
else:
    print("NA")

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