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

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

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

Submission status: Accepted

Solution code:
s = input()
# s_list = list(s)
s_under = int(s[2:]) # YYMM
s_upper = int(s[:2]) # MMYY

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

Submission status: Accepted

Solution code:
S = input()

a = int(S[:2])
b = int(S[2:])
a = True if a>0 and a<13 else False
b = True if b>0 and b<13 else False

if a and b:
  str = 'AMBIGUOUS'
elif a and not b:
  str = 'MMYY'
elif not a and b:
  str = 'YYMM'
else:
  str = 'NA'
  
print(str)

Submission status: Accepted

Solution code:
S = input()
T = str(S)
A=int(T[0:2])
B=int(T[2:4])
if 1<=A<=12:
  if 1<=B<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
elif 1<=B<=12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
T = str(S)
A=int(T[0:2])
B=int(T[2:4])
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:
def is_MMYY(xx, yy):
    if (xx >= 1) and (xx <= 12):
        return True
    return False

def is_YYMM(xx, yy):
    if (yy >= 1) and (yy <= 12):
        return True
    return False

S = list(input())

xx = int("".join(S[:2]))
yy = int("".join(S[2:]))

if is_MMYY(xx, yy) and is_YYMM(xx, yy):
    print("AMBIGUOUS")
elif is_MMYY(xx, yy):
    print("MMYY")
elif is_YYMM(xx, yy):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def check_mm(string):
    if int(string) <= 12 and int(string) > 0:
        return True
    return False


S = input()
former = S[:2]
latter = S[2:]
former_mm = check_mm(former)
latter_mm = check_mm(latter)
if former_mm and latter_mm:
    print('AMBIGUOUS')
elif former_mm:
    print('MMYY')
elif latter_mm:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
string = input()
sep = [int(string[i: i+2]) for i in range(0, len(string), 2)]
if (12 >= sep[0] and sep[0] >= 1) and (12 >= sep[1] and sep[1] >= 1):
    print("AMBIGUOUS")
elif (sep[0] >= 13 or sep[0] == 0) and (sep[1] <=12 and sep[1] >= 1):
    print("YYMM")
elif(sep[0] <= 12 and sep[0] >= 1) and (sep[1] >= 13 or sep[1] == 0):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if (S[:2] in month):
    if (S[2:] in month):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if (S[2:] in month):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
# coding: utf-8
# B - YYMM or MMYY

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

def is_month(num):
    if num > 0 and num < 13:
        return True
    return False

if is_month(f) and is_month(s):
    print('AMBIGUOUS')
elif not is_month(f) and not is_month(s):
    print('NA')
elif is_month(f):
    print('MMYY')
else:
    print('YYMM')

Submission status: Accepted

Solution code:

s1 = input()

s2 = s1[0:2]
s3 = s1[2:4]

f1 = True
f2 = True

if int(s2) <= 0 or int(s2) >= 13:
    f1 = False

if  int(s3) <= 0 or int(s3) >= 13:
    f2 = False

s4 = ""
if f1 == False and f2 == False:
    s4 = "NA"
elif f1 == True and f2 == False:
    s4 = "MMYY"
elif f1 == False and f2 == True:
    s4 = "YYMM"
else:
    s4 = "AMBIGUOUS"

print(s4)

Submission status: Accepted

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

Submission status: Accepted

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

a = int(s[0] + s[1])
b = int(s[2] + s[3])

YYMM = 0
MMYY = 0

if (a >= 1) & (a <= 12):
    MMYY += 1

if (b >= 1) & (b <= 12):
    YYMM += 1

if (YYMM == 1) & (MMYY == 1):
    print('AMBIGUOUS')
elif (YYMM == 0) & (MMYY == 0):
    print('NA')
if (YYMM == 1) & (MMYY == 0):
    print('YYMM')
if (YYMM == 0) & (MMYY == 1):
    print('MMYY')

Submission status: Accepted

Solution code:
S = input()
head = int(S[:2])
tail = int(S[2:])
head_key=False
tail_key=False
if 12>=head>=1:
  head_key=True
if 12>=tail>=1:
  tail_key=True

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

Submission status: Accepted

Solution code:
from datetime import datetime

S = input()

try:
    datetime.strptime(S, '%m%y')
except:
    try:
        datetime.strptime(S, '%y%m')
    except:
        print("NA")
    else:
        print("YYMM")
else:
    try:
        datetime.strptime(S, '%y%m')
    except:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
a,b,c,d=input()
zenhan=int(a)*10+int(b)
kouhan=int(c)*10+int(d)
if zenhan>=13 or zenhan==0:
  if kouhan>=13 or kouhan==0:
    print('NA')
  else:
    print('YYMM')
else:
  if kouhan>=13 or kouhan==0:
    print('MMYY')
  else:
    print('AMBIGUOUS')

Submission status: Accepted

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

if S[:2] in L:
    if S[2:] in L:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if S[2:] in L:
        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()

def isMM(num):
    if 1 <= num <= 12:
        return True
    return False

if isMM(int(S[0:2])) and isMM(int(S[2:])):
    print('AMBIGUOUS')
elif isMM(int(S[0:2])):
    print('MMYY')
elif isMM(int(S[2:])):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
# -*- Coding: utf-8 -*-
import numpy as np
S = raw_input()
first  = int(S[:2])
second = int(S[2:])

if first==0:
    if (second==0)|(second>=13):
        print "NA"
    else:
        print "YYMM"
elif (first>0) & (first<13):
    if (second > 0) & (second<13):
        print "AMBIGUOUS"
    else:
        print "MMYY"
else:
    if (second == 0)|(second>=13):
        print "NA"
    if (second>0) & (second<13):
        print "YYMM"

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
m = int(s[0:2])
n = int(s[2:4])

if m == 00 or m >= 13:
    if n == 00 or n >= 13:
        print("NA")
    else:
        print("YYMM")
else:
    if n == 00 or n >= 13:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = list(input())
A = int("".join([S[0],S[1]]))
B = int("".join([S[2],S[3]]))


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:
def judge(S):
    a=int(S[:2])
    b=int(S[2:])
    if 1<=a<=12 and 1<=b<=12:
        return "AMBIGUOUS"
    elif 1<=a<=12:
        return "MMYY"
    elif 1<=b<=12:
        return "YYMM"
    else:
        return "NA"

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

Submission status: Accepted

Solution code:
S = input()
fh = int(S[:2])
of = int(S[2:])
if 1 <= fh <= 12:
    if 1<= of <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= of <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

fh = ""
of = ""
fh_num = int(S[:2])
of_num = int(S[2:])

if 1 <= fh_num <= 12:
    fh = "M"

if 1 <= of_num <= 12:
    of = "M"

if fh == "" and of == "":
    print("NA")
    exit(0)

if fh == "" and of == "M":
    print("YYMM")
    exit(0)

if fh == "M" and of == "":
    print("MMYY")
    exit(0)

print("AMBIGUOUS")

Submission status: Accepted

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

Submission status: Accepted

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

s = list(input())
a = s[0] + s[1]
a = int(a)
b = s[2] + s[3]
b = int(b)

yymm = False
mmyy = False

if 1 <= b <= 12:
    yymm = True

if 1 <= a <= 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 = input()
num1 = S[:2]
num2 = S[2:]
if 0 < int(num1) <= 12 and 0 < int(num2) <= 12:
    print("AMBIGUOUS")
elif 0 <= int(num1) <= 99 and 0 < int(num2) <= 12:
    print("YYMM")
elif 0 < int(num1) <= 12 and 0 <= int(num2) <= 99:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()

def exammonth(c):
    if 0 < c and c < 13:
        return 1
    else:
        return 0

# def examyear(c):
#     if c == 0:
#         return 0
#     else:
#         return 1

# print(int(S[0:2]))
# print(int(S[2:4]))


if exammonth(int(S[2:4])) == 1:
    if exammonth(int(S[0:2])) == 1:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if exammonth(int(S[0:2])) == 1:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
input_str = input()

num1 = int(input_str[0:2])
num2 = int(input_str[2:4])

def isMonthFormat(num):
    return num >= 1 and num <= 12

flag1 = isMonthFormat(num1)
flag2 = isMonthFormat(num2)

if flag1 and flag2:
    print("AMBIGUOUS")
elif not flag1 and not flag2:
    print("NA")
elif flag1:
    print("MMYY")
else:
    print("YYMM")

Submission status: Accepted

Solution code:
s=input()
n1=int(s[:2])
n2=int(s[2:])

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

Submission status: Accepted

Solution code:
s = input()

first = int(s[:2])
second = int(s[2:])

firstFlag = 0
secondFlag = 0

if first > 12 or first < 1:
	firstFlag = 1

if second > 12 or second < 1:
	secondFlag = 1

if firstFlag == 0:
	if secondFlag == 0:
		print("AMBIGUOUS")
	else:
		print("MMYY")
elif firstFlag == 1:
	if secondFlag == 0:
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
a = s//100
b = s%100
if b <= 12 and b >= 1:
    if a <= 12 and a >= 1:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if a <= 12 and a >= 1:
        print("MMYY")
    else:
        print("NA")

Submission status: Accepted

Solution code:
import re
import sys
input = sys.stdin.readline

s = input()
a = '[0][1-9]' if '0' in s[0] else '[1][0-2]'
b = '[0][1-9]' if '0' in s[2] else '[1][0-2]'
if re.search(b,s[2:4]):
    if re.search(a,s[0:2]):
        ans = 'AMBIGUOUS'
    else:
        ans = 'YYMM'
elif re.search(a,s[0:2]):
    ans = 'MMYY'
else:
    ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
# stdin = open('./input.txt')
l = stdin.readline().rstrip()
month_possible = ['01','02','03','04','05','06','07','08','09','10','11','12']
year_possible = ['00']

fo = ''.join(l[0:2])
la = ''.join(l[2:])

if 0 < int(fo) <= 12:
    if 0 < int(la) <= 12:
        print("AMBIGUOUS")
    elif 0 <= int(la) < 100:
        print("MMYY")
    else:
        print("NA")
else:
    if 0 < int(la) <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()
h = int(s[0:2])
t = int(s[2:4])
#print(h, t)
h_mm = 0
t_mm = 0
if 1 <= h <= 12:
  h_mm = 1
if 1 <= t <= 12:
  t_mm = 1
  
print(["NA", "YYMM", "MMYY", "AMBIGUOUS"][h_mm * 2 + t_mm])

Submission status: Accepted

Solution code:
S=input()
ans='NA'
M_list=['01','02','03','04','05','06','07','08','09','10','11','12']
if S[0:2] in M_list:
	ans='MMYY'
if S[2:4] in M_list:
	if ans=='MMYY':
		ans='AMBIGUOUS'
	else:
		ans='YYMM'
print(ans)

Submission status: Accepted

Solution code:
s = input()

first = s[:2]
second = s[2::]

if 1 <= int(first) <= 12:
    if 1 <= int(second) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= int(second) <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = input()

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

ans = "NA"

if 0 < left <13:
    if 0 < right < 13:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else :
    if 0 < right < 13:
        ans = "YYMM"



print(ans)

Submission status: Accepted

Solution code:
S = input()

S_one = int(S[:2])
S_two = int(S[2:])

if S_one == 0:
    if 1 <= S_two <= 12:
        print('YYMM')
    else:
        print('NA')
elif 1 <= S_one <= 12:
    if 1 <= S_two <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= S_two <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = [int(i) for i in list(input())]
if S[2]*10+S[3]<13 and S[2]+S[3]!=0:
    if S[0]*10+S[1]<13 and S[0]+S[1]!=0:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    if S[0]*10+S[1]<13 and S[0]+S[1]!=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:
    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()

AA = int(S[0:2])
BB = int(S[2:4])

if AA > 0 and AA <= 12:
    A = True
else:
    A = False

if BB > 0 and BB <= 12:
    B = True
else:
    B = False

if A and B:
    print("AMBIGUOUS")
elif B:
    print("YYMM")
elif A:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = [i for i in input()]
mae = S[0]+S[1]
ushiro = S[2]+S[3]
mmyy = True if int(mae)>0 and int(mae)<=12 else False
yymm = True if int(ushiro)>0 and int(ushiro)<=12 else False

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    s = input()
    f = s[:2]
    t = s[2:]
    yymm = (int(t) <= 12 and int(t) != 0)
    mmyy = (int(f) <= 12 and int(f) != 0)
    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()[:4])
a = n//100
b = n%100
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 1<=a<=12 and (b>=13 or b==0):
    print('MMYY')
elif 1<=b<=12 and (13<=a or a==0):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
#!/usr/bin/python
# coding: UTF-8

s = input()
a, b = map(int,(s[:2],s[2:]))

flag = "00"
dict = {
  "00": "NA",
  "10": "MMYY",
  "01": "YYMM",
  "11": "AMBIGUOUS",
}

if 0 < a < 13:
  flag = "1" + flag[1]

if 0 < b < 13:
  flag = flag[0] + "1"
  
print(dict[flag])

Submission status: Accepted

Solution code:
S = input()
left = int(S[:2])
right = int(S[2:])

ans = "NA"
if left == 0:
  if 0 < right < 13:
    ans = "YYMM"
elif right == 0:
  if 0 < left < 13:
    ans = "MMYY"
elif 0 < left < 13:
  if 0 < right < 13:
    ans = "AMBIGUOUS"
  else:
    ans = "MMYY"
elif 0 < right < 13:
  if left > 12:
    ans = "YYMM"
print(ans)

Submission status: Accepted

Solution code:
s = list(input())
count = 0

if s[2] == "1":
    if 0 <= int(s[3]) <= 2:
        count += 1
elif s [2] == "0":
    if  1 <= int(s[3]) <= 9:
        count += 1

if s[0] == "1":
    if 0 <= int(s[1]) <= 2:
        count += 2
elif s [0] == "0":
    if  1 <= int(s[1]) <= 9:
        count += 2

if count == 1:
    print("YYMM")
elif count == 2:
    print("MMYY")
elif count == 3:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/python
# coding: UTF-8

s = input()
a, b = map(int,(s[:2],s[2:]))

flag = "00"
dict = {
  "00": "NA",
  "10": "MMYY",
  "01": "YYMM",
  "11": "AMBIGUOUS",
}

if 0 < a < 13:
  flag = "1" + flag[1]

if 0 < b < 13:
  flag = flag[0] + "1"
  
print(dict[flag])

Submission status: Accepted

Solution code:
#n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for m in range(m)]
#light = [int(i) for i in input().split()]
s = int(input())
#list = list(s)

#print(n, m)
#print(table)
#print(light)

a = s // 100
b = s % 100

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

Submission status: Accepted

Solution code:
S = raw_input()

first = int(S[0:2])
second = int(S[2:])

if first > 0 and first < 13:
    vmf = True
else:
    vmf = False
    
if second > 0 and second < 13:
    vms = True
else:
    vms = False

if vmf and vms:
    print "AMBIGUOUS"
elif vmf and not vms:
    print "MMYY"
elif not vmf and vms:
    print "YYMM"
else:
    print "NA"

Submission status: Accepted

Solution code:
s = input()
if '01' <= s[:2] <= '12':
    if '01' <= s[2:] <= '12':
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if s[2:] > '12' or s[2:] == '00':
        print('NA')
    else:
        print('YYMM')

Submission status: Accepted

Solution code:
s = int(input())
a = 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()
s_1 = S[:2]
s_2 = S[2:]

def mm_checker(s):
  if int(s) <= 12 and int(s) > 0:
    return True
  return False

if mm_checker(s_1) and mm_checker(s_2):
  print('AMBIGUOUS')

elif mm_checker(s_1) and not mm_checker(s_2):
  print('MMYY')
elif not mm_checker(s_1) and mm_checker(s_2):
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

Y = int(S[:2])
M = int(S[2:])

if(Y <= 12 and M <= 12 and Y > 0 and M > 0):
    print('AMBIGUOUS')
elif(Y <= 12 and Y > 0):
    print('MMYY')
elif(M <= 12 and M > 0):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()

def chr_to_index(chr):#文字列を受け取って一文字ずつ配列に入れる
  a = []
  n = len(chr)
  for i in range(n):
    a.append(chr[i])
  return a

my = chr_to_index(s)

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

if mae in range(1,13) and ato in range(1,13):
    print("AMBIGUOUS")
elif mae in range(1,13):
    print("MMYY")
elif ato in range(1,13):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

if 1<=s1 and s1<=12:
    if 0<=s2 and s2<=99:
        if 1<=s2 and s2<=12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        print("NA")
else:
    if 0<=s1 and s1<=99:
        if 1 <= s2 and s2 <= 12:
            print("YYMM")
        else:
            print("NA")
    else:
        if 1 <= s2 and s2 <= 12:
            print("YYMM")
        else:
            print("NA")

Submission status: Accepted

Solution code:
import sys

def check_YYMMorMMYY(str_date):
    str1=str_date[:2]
    str2=str_date[2:]
    num1=int(str1)
    num2=int(str2)
    # if 1<=num1<=12 and 1<=num2<=12:                                                      
    #     print("AMBIGUOUS")                                                               
    # elif 13<=num1<=99 and 1<=num2<=12:                                                   
    #     print("YYMM")                                                                    
    # elif 1<=num1<=12 and 13<=num2<=99:                                                   
    #     print("MMYY")                                                                    
    # elif 13<=num1<=99 and 13<=num2<=99:                                                  
    #     print("NA")                                                                      
    # elif num1==0 or num2==0:                                                             
    #     print("NA")                                                                      
    if 1<=num1<=12:
        if 1<=num2<=12:
            print("AMBIGUOUS")
        else :
            print("MMYY")
    else:
        if 1<=num2<=12:
            print("YYMM")
        else:
            print("NA")

str_S=input()


if str_S.isdecimal()==0 or len(str_S)!=4 :
    print("Unexpected S")
    sys.exit()

check_YYMMorMMYY(str_S)

Submission status: Accepted

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

flagx = flagy = 0
if 1 <= x <= 12:
  flagx = 1
if 1 <= y <= 12:
  flagy = 1
if flagx == 1 and flagy ==  1:
  print("AMBIGUOUS")
elif flagx == 1 and flagy == 0:
  print("MMYY")
elif flagx == 0 and flagy == 1:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
a = input()
over = int(a[:2])
under = int(a[2:])
if 0<over<13 and 0<under<13:
   print("AMBIGUOUS")
elif 0<over<13 and (1>under or under>12):
     print("MMYY")
elif 0<under<13 and (1>over or over>12):
     print("YYMM")
else:
     print("NA")

Submission status: Accepted

Solution code:
s=input()
sh=int(s[0:2])
sl=int(s[2:4])

jh,jl=False,False
if sh>=1 and sh<=12:
    jh=True
if sl>=1 and sl<=12:
    jl=True

if jh and jl:
    print("AMBIGUOUS")
elif jh:
    print("MMYY")
elif jl:
    print("YYMM")
else :
    print("NA")

Submission status: Accepted

Solution code:
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd
def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

# from itertools import accumulate
# from collections import deque
import random


def main():
    l = input()
    l1=int(l[0:2])
    l2=int(l[2:4])
    eprint(l1)
    eprint(l2)
    if 1<=l1<=12 and 1<=l2<=12:
        print("AMBIGUOUS")
    elif 1<=l1<=12:
        print("MMYY")
    elif 1<=l2<=12:
        print("YYMM")
    else:
        print("NA")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
S = input()

aa = S[0:2]
bb = S[2:4]


def isYY(yy):
    if 0 <= int(yy) and int(yy) <= 99:
        return True
    else:
        return False


def isMM(mm):
    if 1 <= int(mm) and int(mm) <= 12:
        return True
    else:
        return False


ans = []
if isYY(aa) and isMM(bb):
    # YYMM
    ans.append('YYMM')
if isMM(aa) and isYY(bb):
    # MMYY
    ans.append('MMYY')

if len(ans) >= 2:
    print('AMBIGUOUS')
elif len(ans) == 1:
    print(ans[0])
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
def chk(n):
    if 0<n<=12: return 1
    else: 0

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

if chk(a) and chk(b): print("AMBIGUOUS")

elif chk(a) and not chk(b): print("MMYY")

if not chk(a) and chk(b) : print("YYMM")

if not chk(a) and not chk(b): print("NA")

Submission status: Accepted

Solution code:
s=input()
x=int(s[:2])
y=int(s[2:])
a=b=0
if(y<=12)and(y>=1):
    a=1
if(x<=12)and(x>=1):
    b=1

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

def isMonth(i) :
    if i >= 1 and i <= 12 :
        return True
    else :
        return False

if isMonth(A) and isMonth(B) :
    print('AMBIGUOUS')
elif not isMonth(A) and isMonth(B) :
    print('YYMM')
elif isMonth(A) and not isMonth(B) :
    print('MMYY')
else :
    print('NA')

Submission status: Accepted

Solution code:
s = int(input())
left = s // 100
right = s % 100
left_is_MM = (1 <= left <= 12)
right_is_MM = (1 <= right <= 12)
if(left_is_MM) and (right_is_MM):
    print('AMBIGUOUS')
elif(left_is_MM):
    print('MMYY')
elif(right_is_MM):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()
a = int(s[:2])
b = int(s[2:])
if a <= 12 and a > 0:
	if b <=12 and b > 0:
		print('AMBIGUOUS')
	else:
		print('MMYY')
else:
	if b <=12 and b > 0:
		print('YYMM')
	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")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
ss = input()
s = int(ss)

ue = s // 100
sita = s % 100
if ue > 12:
    if sita <= 12 and sita != 0:
        print("YYMM")
    else:
        print("NA")
elif ue == 0:
    if sita <= 12 and sita != 0:
        print("YYMM")
    else:
        print("NA")
else:
    if sita <= 12 and sita != 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")

Submission status: Accepted

Solution code:
#ABC 126
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()
l = 1 <= int(s[:2]) <= 12
r = 1 <= int(s[2:]) <= 12
if l:
    if r:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if r:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input().strip()

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

if 1 <= s0 <= 12 and 1 <= s1 <= 12:
    print("AMBIGUOUS")
elif 1 <= s0 <= 12 and not 1 <= s1 <= 12:
    print("MMYY")
elif not (1 <= s0 <= 12) and 1 <= s1 <= 12:
    print("YYMM")
elif not (1 <= s0 <= 12) and not 1 <= s1 <= 12:
    print("NA")

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
S = input()
year = int(S[:2])
month = int(S[2:])
if (month <= 12 and month >=1) and (year >= 1 and year <= 12):
    print('AMBIGUOUS')
elif (month <= 12 and month >= 1) and ((year >= 13 and year <= 99) or (year==0)):
    print('YYMM')
elif (year <= 12 and year >= 1) and ((month >= 13 and month <= 99) or (month==0)):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S=input()
b=int(S[:2])
a=int(S[2:])
c=(b<1)+(b>12)
d=((a<1)+(a>12))*2
e=c+d
print(["AMBIGUOUS","YYMM","MMYY","NA"][e])