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:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
s = S()
ans = ''
xx = int(s[0:2])
zz = int(s[2:4])
if xx < 13 and zz < 13 and xx != 0 and zz != 0:
    ans = 'AMBIGUOUS'
elif xx < 13 and xx != 0:
    ans = 'MMYY'
elif zz < 13 and zz != 0:
    ans = 'YYMM'
else:
    ans = 'NA'
print(ans)

Submission status: Accepted

Solution code:
from itertools import product
s=input()
y=["0","1","2","3","4","5","6","7","8","9"]
yy=list((x+y for x,y in product(y,repeat=2)))
mm=["01","02","03","04","05","06","07","08","09","10","11","12"]

ans="NA"
if (s[0:2] in yy and s[2:4] in mm) and (s[0:2] not in mm or  s[2:4]  not in yy):
    ans="YYMM"
elif (s[0:2] in mm and s[2:4] in yy) and (s[0:2] not in yy or  s[2:4]  not in mm):
    ans="MMYY"
elif (s[0:2] in mm and s[2:4] in yy) and (s[0:2] in yy or  s[2:4]  in mm):
    ans="AMBIGUOUS"

print(ans)

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

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

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

Submission status: Accepted

Solution code:
S = input()
S_front = S[:2]
S_back = S[2:]

if 0 < int(S_front) < 13:
	if 0 < int(S_back) < 13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 0 < int(S_back) < 13:
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
if s == '0000' or (int(s[:2]) >= 13 and int(s[-2:]) >= 13):
    print('NA')
elif 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()
x=int(S[:2])
y=int(S[2:4])
if 1<=x<=12:
    if 1<=y<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=y<=12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def check_month(month):
    return 1 <= int(month) <= 12

S = input()

ls = S[:2]
rs = S[2:]

if check_month(ls) and check_month(rs):
    print('AMBIGUOUS')
elif check_month(ls) and not check_month(rs):
    print('MMYY')
elif not check_month(ls) and check_month(rs):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = int(input())

a = S//100
b = S%100

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

Submission status: Accepted

Solution code:
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

#https://atcoder.jp/contests/abc126/tasks/abc126_b

def is_mm(s):
	return int(s) >= 1 and int(s) <= 12

def is_yy(s):
	return True

def main():
	#a = int(input())
	#b , c = IN()
	s = input()
	is_mmxx=is_mm(s[:2])
	is_yyxx=is_yy(s[:2])
	is_xxmm=is_mm(s[2:])
	is_xxyy=is_yy(s[2:])
	ra = 'AMBIGUOUS'
	rb = 'NA'
	rc = 'YYMM'
	rd = 'MMYY'
	
	if is_mmxx and is_xxyy and is_xxmm and is_yyxx:
		return ra
	elif is_mmxx and is_xxyy:
		return rd
	elif is_yyxx and is_xxmm:
		return rc
	else:
		return rb
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

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

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

Submission status: Accepted

Solution code:
N = int(input())
a = N // 100
b = N % 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:
def main():
    S = input()
    first = S[:2]
    second = S[2:]
    YYMM = False
    MMYY = False

    if "00" <= first <= "99" and "01" <= second <= "12":
        YYMM = True
    if "01" <= first <= "12" and "00" <= second <= "99":
        MMYY = True

    if YYMM and MMYY:
        ans = "AMBIGUOUS"
    elif YYMM:
        ans = "YYMM"
    elif MMYY:
        ans = "MMYY"
    else:
        ans = "NA"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import re

s = input()


def is_valid_yymm(s):
    match = re.search('^[0-9]{2}(01|02|03|04|05|06|07|08|09|10|11|12)$', s)
    return bool(match)
    

def is_valid_mmyy(s):
    match = re.search('^(01|02|03|04|05|06|07|08|09|10|11|12)[0-9]{2}$', s)
    return bool(match)


if is_valid_yymm(s) and is_valid_mmyy(s):
    print('AMBIGUOUS')
elif is_valid_yymm(s):
    print('YYMM')
elif is_valid_mmyy(s):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

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

if S[:2] in MM and S[2:] in MM:
  print("AMBIGUOUS")
elif S[:2] in MM:
  print("MMYY")
elif S[2:] in MM:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_month(x):
  if 1 <= x <= 12:
    return True
  else:
    return False

S = input()
first, latter = is_month(int(S[:2])), is_month(int(S[2:]))
if first and latter:
  ans = "AMBIGUOUS"
elif not first and not latter:
  ans = "NA"
elif first:
  ans = "MMYY"
else:
  ans = "YYMM"
print(ans)

Submission status: Accepted

Solution code:
S = input()

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

if((former >= 13 or former == 0) and 1 <= latter <= 12):
    print("YYMM")
if((latter >= 13 or latter == 0) and 1 <= former <= 12):
    print("MMYY")
if(1 <= former <= 12 and 1 <= latter <= 12):
    print("AMBIGUOUS")
if((former >= 13 or former == 0) and (latter >= 13 or latter == 0)):
    print("NA")

Submission status: Accepted

Solution code:
s=input()

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

Submission status: Accepted

Solution code:
s = input()
if s[0:2] in "01 02 03 04 05 06 07 08 09 10 11 12":
  l = "m"
else:
  l = "y"
if s[2:4] in "01 02 03 04 05 06 07 08 09 10 11 12":
  r = "m"
else:
  r = "y"
if l+r == "mm":
  print("AMBIGUOUS")
elif l+r == "my":
  print("MMYY")
elif l+r == "ym":
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
a = s[0] + s[1]
b = s[2] + s[3]
p = 0
q = 0
if a == "01" or a == "02" or a == "03" or a == "04" or a == "05" or a == "06" or a == "07" or a == "08" or a == "09" or a == "10" or a == "11" or a == "12":
    p = 1
if b == "01" or b == "02" or b == "03" or b == "04" or b == "05" or b == "06" or b == "07" or b == "08" or b == "09" or b == "10" or b == "11" or b == "12":
    q = 1  
if p == 1 and q == 1:
    print("AMBIGUOUS")
elif p == 1 and q == 0:
    print("MMYY")
elif p == 0 and q == 1:
    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 = input().rstrip()

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

Submission status: Accepted

Solution code:
S = input()
ans = [0,0]

if 1<=int(S[:2]) and int(S[:2]) <= 12 :
    ans[0] = 1
if 1 <=int(S[2:]) and int(S[2:]) <= 12 :
    ans[1] = 1

if ans == [1,1] :
    print('AMBIGUOUS')
elif ans == [0,0] :
    print('NA')
elif ans == [0,1] :
    print('YYMM')
elif ans == [1,0] :
    print('MMYY')

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    S = ins()
    a = int(S[:2])
    b = int(S[2:])
    am = 0 < a < 13
    bm = 0 < b < 13
    if am and bm:
        return "AMBIGUOUS"
    elif am:
        return "MMYY"
    elif bm:
        return "YYMM"
    else:
        return "NA"


print(solve())

Submission status: Accepted

Solution code:
n = list(input())
x = int(n[0]+n[1])
y = int(n[2]+n[3])

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

Submission status: Accepted

Solution code:
s=input()

def month(n):
    if 1 <= n <= 12:
        return True
    else:
        return False


if int(s[0:2]) == 0:
    if month(int(s[2:4])) :
        print("YYMM")
        exit()
    else:
        print("NA")
        exit()

if int(s[2:4]) == 0:
    if month(int(s[0:2])):
        print("MMYY")
        exit()
    else:
        print("NA")
        exit()


if month(int(s[0:2])):
    if month(int(s[2:4])):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if month(int(s[2:4])):
            print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()

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

if (0 < first < 13):
	if (0 < last < 13):
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if (0 < last < 13):
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

Solution code:

s = input()
a=int(s[0:2])
b=int(s[2:4])
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 0<b<=12:
    print('YYMM')
elif 0<a<=12 :
    print('MMYY')

else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
def YYMM(s):
    p = int(s[2:])
    if 1 <= p <= 12:
        return True
    return False

def MMYY(s):
    p = int(s[:2])
    if 1 <= p <= 12:
        return True 
    return False

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

Submission status: Accepted

Solution code:
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
s = str(input())
num = ['01','02','03','04','05','06','07','08','09','10','11','12']
if s[:2] in num and s[2:] in num:
    print("AMBIGUOUS")
elif s[:2] in num:
    print("MMYY")
elif s[2:] in num:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=list(input())
s=list(map(int,s))

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

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

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 and int(s[2:]) >= 0:
  print('MMYY')
elif 0 < int(s[2:]) <= 12 and int(s[:2]) >= 0:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
s = str(input())
ans = ['YYMM','MMYY','AMBIGUOUS','NA']
#print(s[:2],s[-2:])
if (0==int(s[:2]) or 13<=int(s[:2])) and (0==int(s[-2:]) or 13<=int(s[-2:])):
    print(ans[3])
if 0<int(s[:2])<=12 and 0<int(s[-2:])<=12:
    print(ans[2])
elif 0<int(s[:2])<=12:
    print(ans[1])
elif 0<int(s[-2:])<=12:
    print(ans[0])

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()
s1=s[0]+s[1]
s2=s[2]+s[3]
n1=int(s1)
n2=int(s2)
if 1<=n1<=12:
    if 1<=n2<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=n2<=12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit
S = input()

if 0 < int(S[0:2]) < 13:
    if 0 < int(S[2:]) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(S[2:]) < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    S = SS()

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
s = int(input())
s1 = s // 100
s2 = s % 100
c = 0
l = ["NA","YYMM","MMYY","AMBIGUOUS"]
if 1<=s2<=12:
  c += 1
if 1<=s1<=12:
  c += 2
print(l[c])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input().rstrip()
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=list(input())
S=[]
for i in range(len(s)):
    S.append(int(s[i]))
if 1<=S[2]*10+S[3] and S[2]*10+S[3]<=12:
    if 1<=S[0]*10+S[1] and S[0]*10+S[1]<=12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if 1<=S[0]*10+S[1] and S[0]*10+S[1]<=12:
        print('MMYY')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()
sform = int(S[:2])
slatt = int(S[2:])

if sform <= 12 and sform >= 1:
    if slatt <= 12 and slatt >= 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')

else:
    if slatt <= 12 and slatt >= 1:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s = input()
v=0
for i in range(4):
    v = v*10+int(s[i])
v1 = v//100
v2 = v%100
if 12>=v1>=1 and 12>=v2>=1:
    print("AMBIGUOUS")
elif (v1>=13 or v1==0) and 12>=v2>=1:
    print("YYMM")
elif (v2>=13 or v2==0) and 12>=v1>=1:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=input()

first_two=int(''.join(s[:2]))
last_two=int(''.join(s[2:]))

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

Submission status: Accepted

Solution code:
s = list(map(int, input()))
l = [0]*2
l[0] = s[0]*10 + s[1]
l[1] = s[2]*10 + s[3]

F = False
L = False

if 0 < l[0] <= 12:
  F = True
if 0 < l[1] <= 12:
  L = True

if F == True and L == True:
  print('AMBIGUOUS')

elif F == True:
  print('MMYY')

elif L == True:
  print('YYMM')

else:
  print('NA')

Submission status: Accepted

Solution code:
s = input()
if (int(s[:2]) == 0 or int(s[:2]) > 12)&(0 < int(s[2:]) <= 12):
    print("YYMM")
    
elif (0 < int(s[:2]) <= 12)&(int(s[2:]) == 0 or int(s[2:]) > 12):
    print("MMYY")

elif (0 < int(s[:2]) <= 12)&(0 < int(s[2:]) <= 12):
    print("AMBIGUOUS")

else:
    print("NA")

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    if 1 <= int(S[:2]) <= 12:
        is_MMYY = True
    else:
        is_MMYY = False

    if 1 <= int(S[2:]) <= 12:
        is_YYMM = True
    else:
        is_YYMM = False

    if is_MMYY and is_YYMM:
        ans = "AMBIGUOUS"
    elif is_MMYY:
        ans = "MMYY"
    elif is_YYMM:
        ans = "YYMM"
    else:
        ans = "NA"

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
s = input()
a, b = s[:2], s[2:]
if '01' <= a <= '12':
    if '01' <= b <= '12':
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if '01' <= b <= '12':
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s=str(input())
a="Y"
b="Y"
if 0<int(s[0:2])<13:
    a="MY"
if 0<int(s[2:5])<13:
    b="MY"

if a==b=="Y":
    ans="NA"
elif a=="Y" and b=="MY":
    ans="YYMM"
elif a=="MY" and b=="Y":
    ans="MMYY"
else:
    ans="AMBIGUOUS"
print(ans)

Submission status: Accepted

Solution code:
a, b = divmod(int(input()), 100)
x = "MM" if 0 < a < 13 else "YY"
y = "MM" if 0 < b < 13 else "YY"
print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS")

Submission status: Accepted

Solution code:
s = int(input())
a, b = s // 100, s % 100
x = "YY" if a == 0 or a > 12 else "MM"
y = "YY" if b == 0 or b > 12 else "MM"
print(x + y if x != y else "NA" if x == "YY" else "AMBIGUOUS")

Submission status: Accepted

Solution code:
s = int(input())
a, b = s // 100, s % 100
x = "YY" if a == 0 or a > 12 else "MM"
y = "YY" if b == 0 or b > 12 else "MM"
if x != y:
    print(x + y)
else:
    print("NA" if x == "YY" else "AMBIGUOUS")

Submission status: Accepted

Solution code:
def solve():
    s = input()
    a = int(s[:2])
    if a == 0 or a > 12:
        x = "YY"
    else:
        x = "MM"
    b = int(s[2:])
    if b == 0 or b > 12:
        y = "YY"
    else:
        y = "MM"
    if x + y == "YYYY":
        print("NA")
    elif x + y == "MMMM":
        print("AMBIGUOUS")
    else:
        print(x + y)


solve()

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
flag1=0
flag2=0
if 0<int(s[:2])<13:
  flag1=1
else:
  pass
if 0<int(s[2:])<13:
  flag2=1
else:
  pass

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

Submission status: Accepted

Solution code:
S = int(input())

if 0 < S//100 < 13:
    if 0 < S%100 < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < S%100 < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()

if int(S[0:2]) > 12 or S[0:2] == "00":
    if 0 < int(S[2:4]) <= 12:
        print("YYMM")
    else:
        print("NA")
else:
    if 0 < int(S[2:4]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
bef = s[:2]
aft = s[2:]

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

if (front > 12 and rear > 12) or (front > 12 and rear == 0) or (rear > 12 and front == 0) or (front == 0 and rear == 0):
    print("NA")
    exit()
elif 0 < rear <= 12 and (front > 12 or front == 0):
    print("YYMM")
    exit()
elif 0 < front <= 12 and (rear > 12 or rear == 0):
    print("MMYY")
elif 0 < front <= 12 and 0 < rear <= 12:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()
YYMM = 0
MMYY = 0
start = S[0:2]
end = S[2:4]
tmp1 = int(start)
tmp2 = int(end)
if(tmp2 <= 12 and tmp2 != 0):
    YYMM = 1
if(tmp1 <= 12 and tmp1 != 0):
    MMYY = 1
if(YYMM == 1 and MMYY == 1):
    print("AMBIGUOUS")
elif(YYMM == 1):
    print("YYMM")
elif(MMYY == 1):
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = input()
mae = int(s[:2])
ato = int(s[2:])

flag1 = 0
flag2 = 0
if 0<mae and mae<=12:
    flag1 = 1
if 0<ato and ato<=12:
    flag2 = 1

if flag1 == 1 and flag2 == 1:
    print('AMBIGUOUS')
elif flag1 == 1:
    print('MMYY')
elif flag2 == 1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
ANS = {0:'NA', 1:'YYMM', 2:'MMYY', 3:'AMBIGUOUS'}
ans = 0
if '00' <= S[:2] <= '99' and '01' <= S[2:] <= '12':
    ans += 1
if '00' <= S[2:] <= '99' and '01' <= S[:2] <= '12':
    ans += 2
print(ANS[ans])

Submission status: Accepted

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

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

if m(f) and m(l):
  print("AMBIGUOUS")
elif m(f):
  print("MMYY")
elif m(l):
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

Solution code:
# 月のフォーマットによる場合分け。
s = list(input())
# 前二桁
s1 = int("".join(s[:2]))
# 後二桁
s2 = int("".join(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 = list(input())
s1 = int("".join(s[:2]))
s2 = int("".join(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=input()
A=int(S[0:2])
B=int(S[2:4])
if (1<=A and A<=12) and (1<=B and B<=12):
  print("AMBIGUOUS")
elif (1<=A and A<=12) and not(1<=B and B<=12):
  print("MMYY")
elif not(1<=A and A<=12) and (1<=B and B<=12):
  print("YYMM")
else:
  print("NA")

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()
A = int(S[0] + S[1])
B = int(S[2] + S[3])

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

Submission status: Accepted

Solution code:
s = input()

s_a = int(s[:2])
s_b = int(s[2:])

if 1 <= s_a <=12 and 1 <= s_b <=12:
  ans = "AMBIGUOUS"
elif not(1 <= s_a <=12) and 1 <= s_b <=12:
  ans = "YYMM"
elif 1 <= s_a <=12 and not(1 <= s_b <=12):
  ans = "MMYY"
else:
  ans = "NA"

print(ans)

Submission status: Accepted

Solution code:
s = input()

s_a = int(s[:2])
s_b = int(s[2:])

if s_a >= 1 and s_a <=12 and s_b >= 1 and s_b <=12:
  ans = "AMBIGUOUS"
elif (s_a > 12 or s_a == 0) and s_b >= 1 and s_b <=12:
  ans = "YYMM"
elif (s_b > 12 or s_b == 0) and s_a >= 1 and s_a <=12:
  ans = "MMYY"
else:
  ans = "NA"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if left > 12 or left == 0:
    year_flag[0] += 1
if right > 12 or right == 0:
    year_flag[1] += 1

if sum(year_flag) == 2:
    print('NA')
elif sum(year_flag) == 0:
    print('AMBIGUOUS')
elif year_flag[0] == 1:
    print('YYMM')
else:
    print('MMYY')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

s = readline().rstrip()
a = int(s[:2])
b = int(s[2:])
if 0 < a < 13 and 0 < b < 13:
    ans = "AMBIGUOUS"
elif 0 < a < 13:
    ans = "MMYY"
elif 0 < b < 13:
    ans = "YYMM"
else:
    ans = 'NA'
print(ans)