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()
s1 = int(s[0:2])
s2 = int(s[2:])

isYM , isMY= False, False
if s1 >= 0 and s1 <= 99 and s2 >= 1 and s2 <= 12: isYM = True
if s1 >= 1 and s1 <= 12 and s2 >= 0 and s2 <= 99: isMY = True

if isYM and isMY:
    print("AMBIGUOUS")
elif isYM:
    print("YYMM")
elif isMY:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

aa = 10*int(s[0]) + int(s[1])
bb = 10*int(s[2]) + int(s[3])
if 1 <= aa <= 12 and 1 <= bb <= 12:
    print("AMBIGUOUS") 
elif 0 <= aa <= 99 and 1 <= bb <= 12:
    print("YYMM")
elif 1 <= aa <= 12 and 0 <= bb <= 99:
    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:
    print('AMBIGUOUS')
elif 1 <= a <= 12:
    print('MMYY')
elif 1 <= b <= 12:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()

S_list = [c for c in S]
zenhan = 10 * int(S_list[0]) + int(S_list[1])
kouhan =  10 * int(S_list[2]) + int(S_list[3])

if zenhan > 0 and zenhan < 13:
  if kouhan > 0 and kouhan < 13:
    print('AMBIGUOUS')
    exit()
  else:
    print('MMYY')
    exit()
else:
  if kouhan > 0 and kouhan < 13:
    print('YYMM')
    exit()
  else:
    print('NA')
    exit()

Submission status: Accepted

Solution code:
S = input()

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

if a < 0 or 99 < a:
    x = 0
elif 0 <= a < 1 or 12 < a <= 99:
    x = 1
else:
    x = 2

if b < 0 or 99 < b:
    y = 0
elif 0 <= b < 1 or 12 < b <= 99:
    y = 1
else:
    y = 2

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#ABC127B
S = input()
ab,cd = S[0:2],S[2:4]
if ab == "00" and cd == "00":
    print("NA")
elif int(ab) >= 13 and int(cd) >= 13:
    print("NA")
elif ab == "00" and int(cd) >=13:
    print("NA")
elif int(ab) >=13 and cd =="00":
    print("NA")
elif ab == "00" and int(cd) <= 12:
    print("YYMM")
elif int(ab) <= 12 and cd == "00":
    print("MMYY")
elif int(ab) <= 12 and int(cd) <= 12:
    print("AMBIGUOUS")
elif int(ab) <= 12 and int(cd) >= 13:
    print("MMYY")
elif int(ab) >= 13 and int(cd) <= 12:
    print("YYMM")

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
s = int(input())
s1 = s//100
s2 = s%100
if s1>12 or s1==0:
  if s2==0 or s2>12:
    print("NA")
  else:
    print("YYMM")
else:
  if s2==0 or s2>12:
    print("MMYY")
  else:
    print("AMBIGUOUS")

Submission status: Accepted

Solution code:
s = input()
yy = int(s[0:2])
mm = int(s[2:4])
def month(num):
  return True if 1 <= num and num <= 12 else False
  
if month(mm) and month(yy):
  print("AMBIGUOUS")
elif month(mm):
    print("YYMM")
elif month(yy):
    print("MMYY")
else:
  print("NA")

Submission status: Accepted

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

if 1 <= pre <= 12 and 1 <= post <= 12:
    print('AMBIGUOUS ')
elif 0 <= pre <= 99 and 1 <= post <= 12:
    print('YYMM')
elif 1 <= pre <= 12 and 0 <= post <= 99:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

s1 = s[0:2]
s2 = s[2:4]
l = []

flg = 0
if 1 <= int(s1) <= 12:
    flg += 10

if 1<= int(s2) <= 12:
    flg += 1
    

if flg == 0:
    print('NA')
elif flg == 1:
    print('YYMM')
elif flg == 10:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Accepted

Solution code:
S = input()

n1 = int(S[0]) * 10 + int(S[1])
n2 = int(S[2]) * 10 + int(S[3])

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

Submission status: Accepted

Solution code:
while True:
    try:
        string = input()
        if int(string[:2]) > 0 and int(string[:2]) <= 12:
            if int(string[2:]) > 0 and int(string[2:]) <= 12:
                print('AMBIGUOUS')
            else:
                print('MMYY')
        else:
            if int(string[2:]) > 0 and int(string[2:]) <= 12:
                print('YYMM')
            else:
                print('NA')
    except:
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: int):
    s = '{:04d}'.format(S)
    a, b = str(s)[:2], str(s)[2:]

    def judge(s):
        if s == '00' or int(s) > 12:
            return 'y'
        return 'ym'

    fa, fb = judge(a), judge(b)

    if fa == 'y' and fb == 'y':
        print('NA')
    elif fa == 'y' and fb == 'ym':
        print('YYMM')
    elif fa == 'ym' and fb == 'y':
        print('MMYY')
    elif fa == 'ym' and fb == 'ym':
        print('AMBIGUOUS')
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
ymflag = True
myflag = True
head = int(s[:2])
tail = int(s[2:])
if head > 12:
    myflag = False
elif head == 0:
    myflag = False

if tail > 12:
    ymflag = False
elif tail == 0:
    ymflag = False
if ymflag and myflag:
    print("AMBIGUOUS")
elif ymflag:
    print("YYMM")
elif myflag:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=input()
a=int(s[:2])
b=int(s[2:])
def f(a):
    a1,a2=0,0
    if 1<=a<=12:
        a1=1
    if 0<=a<=99:
        a2=1
    return (a1,a2)
a1,a2=f(a)
b1,b2=f(b)
if a1 and a2 and b1 and b2:
    print('AMBIGUOUS')
elif a1 and b2:
    print('MMYY')
elif a2 and b1:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
X = input()

X1 = 10*int(X[0]) + int(X[1])
X2 = 10*int(X[2]) + int(X[3])
if (1 <= X1 <= 12) and ((X2 > 12) or (X2 == 0)):
    print("MMYY")
elif ((X1 > 12) or (X1 == 0)) and (1 <= X2 <= 12):
    print("YYMM")
elif (1 <= X1 <= 12) and (1 <= X2 <= 12):
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    S = str(input())
    
    AA = int(S[:2])
    BB = int(S[2:4])
    
    month = [i for i in range(1, 13)]
    
    if AA in month:
        if BB in month:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    
    elif BB in month:
            print('YYMM')
    
    else:
        print('NA')

Submission status: Accepted

Solution code:
S = input()
SL = int(S[:2])
SR = int(S[2:])
if 1 <= SL <= 12:
    if 1 <= SR <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= SR <= 12:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
while True:
    try:
        S = input()
        n1 = int(S[:2])
        n2 = int(S[2:])
        isYYMM = False
        isMMYY = False
        if 1<=n1<=12:
            isMMYY = True
        if 1<=n2<=12:
            isYYMM = True
        if isMMYY and isYYMM:
            print("AMBIGUOUS")
        elif (not isMMYY) and (not isYYMM):
            print("NA")
        elif isMMYY:
            print("MMYY")
        elif isYYMM:
            print("YYMM")
    except:
        break

Submission status: Accepted

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

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 0 < int(s[: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:
S = input() 
is_yymm = 1 <= int(S[2:]) <= 12
is_mmyy = 1 <= int(S[:2]) <= 12

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

Submission status: Accepted

Solution code:
S = input() 
is_yymm = 1 <= int(S[2:4]) <= 12
is_mmyy = 1 <= int(S[0:2]) <= 12

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(S: int):
    a = S//100
    b = S%100
    if a < 1 or a >12:
        if b < 1 or b > 12:
            print('NA')
        else:
            print('YYMM')
    else:
        if b < 1 or b > 12:
            print('MMYY')
        else:
            print('AMBIGUOUS')
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)

if __name__ == '__main__':
    main()

Submission status: Accepted

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


if x == "01" or x == "02"  or x == "03" or x == "04"  or x == "05"  or x == "06"  or x == "07"  or x == "08"  or x == "09"  or x == "10"  or x == "11"  or x == "12":
    if y == "01" or y == "02"  or y == "03" or y == "04"  or y == "05"  or y == "06"  or y == "07"  or y == "08"  or y == "09"  or y == "10"  or y == "11"  or y == "12":
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif y == "01" or y == "02"  or y == "03" or y == "04"  or y == "05"  or y == "06"  or y == "07"  or y == "08"  or y == "09"  or y == "10"  or y == "11"  or y == "12":
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
N= input()
mae = int(N[0]+N[1])
ato = int(N[2]+N[3])
a = 0
b = 0
if 0<mae and mae<13:
  a = 1
if 0 < ato and ato < 13:
  b = 1
if a == 1:
  if b == 1:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if b == 1:
    print('YYMM')
  else:
    print('NA')

Submission status: Accepted

Solution code:
from datetime import datetime
s = input()
def is_yymm(ss):
  try:
    datetime.strptime(ss, '%y%m')
    return True
  except:
    pass
def is_mmyy(ss):
  try:
    datetime.strptime(ss, '%m%y')
    return True
  except:
    pass
if is_yymm(s) and is_mmyy(s):
  print('AMBIGUOUS')
elif is_yymm(s):
  print('YYMM')
elif is_mmyy(s):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
s1, s2 = int(s[:2]), 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 = list(i for i in input())
x,y = int(s[0] + s[1]),int(s[2] + s[3])
if x < 13 and x > 0 and y < 13 and y > 0:
  print('AMBIGUOUS')
elif (x >= 13 or x == 0) and y < 13 and y > 0:
  print('YYMM')
elif x < 13 and x > 0 and (y >= 13 or y == 0):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

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

left = s[0]*10 + s[1]
right = s[2]*10 + s[3]

isMonthL = False
isMonthR = False

if 0 < left and left < 13:
    isMonthL = True

if 0 < right and right < 13:
    isMonthR = True

if isMonthR and isMonthL:
    print("AMBIGUOUS")
elif isMonthL and not isMonthR:
    print("MMYY")
elif not isMonthL and isMonthR:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
S = input()
S_list = list(S)
A = int(S_list[0]) * 10 + int(S_list[1])
B = int(S_list[2]) * 10 + int(S_list[3])

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

Submission status: Accepted

Solution code:
s = input()

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

def can_be_month(x):
    if 1 <= x <= 12:
        return True
    else:
        return False

if can_be_month(first) and can_be_month(second):
    print("AMBIGUOUS")
elif can_be_month(first) and not can_be_month(second):
    print("MMYY")
elif not can_be_month(first) and can_be_month(second):
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
S = input()

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


if 12>=int(head)>=1 and 12>=int(tail)>=1:
    print("AMBIGUOUS")
elif 12>=int(head)>=1:
    print("MMYY")
elif 12>=int(tail)>=1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
msg=input()
pp=msg[0:1+1];p=int(pp)
qq=msg[2:3+1];q=int(qq)
if 1<=p<=12:
  if 1<=q<=12:
  	print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 1<=q<=12:
    print("YYMM")
  else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input()
y = int(s[:2])
m = int(s[2:])


def is_m(x):
    return 0 < x < 13


if is_m(y) and is_m(m):
    print('AMBIGUOUS')
elif not is_m(y) and not is_m(m):
    print('NA')
elif not is_m(y) and is_m(m):
    print('YYMM')
else:
    print('MMYY')

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S =input()
#MMYYcheck
ans = "NA"
if 0 < int(S[0])*10+int(S[1]) < 13 :
    ans = "MMYY"
if 0<int(S[2])*10+int(S[3])<13:
    if ans == "MMYY":
         ans ="AMBIGUOUS"
    else: ans ="YYMM"
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

def isMonth(S):
    if 1<=int(S)<=12:
        return True
    else:
        return False

s1, s2 = S[:2], S[2:]
if isMonth(s1) & isMonth(s2):
    print('AMBIGUOUS')
elif isMonth(s1):
    print('MMYY')
elif isMonth(s2):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = list(input())

left = int(s[0]) * 10 + int(s[1])
right = int(s[2]) * 10 + int(s[3])

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

Submission status: Accepted

Solution code:
a, b, c, d = list(input())
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if 0 < 10*a + b <= 12 and 0 < c*10 + d <= 12:
    print('AMBIGUOUS')
elif (10*a + b >= 12 or a + b == 0) and 0 < c*10 + d <= 12:
    print('YYMM')
elif 0 < 10*a + b <= 12 and (c*10 + d >= 12 or c + d == 0):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

year = int(s[0:2])
month = int(s[2:4])

mmy = False
yym = False

if 1 <= year <= 12:
    mmy = True
if 1 <= month <=12:
    yym = True
if mmy and yym:
    print('AMBIGUOUS')
elif yym:
    print('YYMM')
elif mmy:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()
former=int(s[:2])
latter=int(s[2:])

if former>0 and former<13:
    if latter>0 and latter<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if latter>0 and latter<13:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = input()
a = int(S[0:2])
b = int(S[2:4])
fym = False
fmy = False
if 1<=a<=12:
  fmy = True
if 1<=b<=12:
  fym = True
if fmy and fym:
  print("AMBIGUOUS")
elif fmy:
  print("MMYY")
elif fym:
  print("YYMM")
else:
  print("NA")

Submission status: Accepted

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

f = False
f2 = False
if (S[2:] in M): f = True
if (S[:2] in M): f2 = True

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

Submission status: Accepted

Solution code:
s=input()
a,b=int(s[:2]),int(s[2:])
print(['NA','MMYY','YYMM','AMBIGUOUS'][(0<a<13)-(0<b<13)*2])

Submission status: Accepted

Solution code:
S=input()
if 0<int(S[: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:
S=input()

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

Submission status: Accepted

Solution code:
s = input()
former = int(s[0]+s[1])
latter = int(s[2]+s[3])
# print(former,latter)
A = former > 0 and former < 13
B = latter > 0 and latter < 13
# print(A,B)
if A and B:
    print('AMBIGUOUS')
elif A:
    print('MMYY')
elif B:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = list(input())
a,b = "",""
f1,f2 = False,False
for i in range(2):
    a += s[i]
    b += s[i+2]
if 0<int(a)<13:
    f1 = True
if 0<int(b)<13:
    f2 = True
if f1 and f2:
    print("AMBIGUOUS")
elif f1:
    print("MMYY")
elif f2:
    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 = list(input())
AA = int(S[0])*10+int(S[1])
BB = int(S[2])*10+int(S[3])

ans = ""

if AA < 13 and AA != 0 and BB < 13 and BB != 0:
    ans = "AMBIGUOUS"
elif (AA >= 13 or AA == 0)and BB <13 and BB != 0:
    ans = "YYMM"
elif AA < 13 and AA != 0 and (BB >= 13 or BB == 0):
    ans = "MMYY"
else:
    ans = "NA"

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

left_s = S[:2]
right_s = S[2:]
# print(left_s, right_s)


YYMM = False
MMYY = False
# どちらもTrueになってたらAMBIGUOUSを出力

if int(left_s) >= 0 and 99 >= int(left_s) and int(right_s) > 0 and 12 >= int(right_s):
    YYMM = True

if int(left_s) > 0 and 12 >= int(left_s) and int(right_s) >= 0 and 99 >= int(right_s):
    MMYY = True

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

p1 = int(S[:2])
p2 = int(S[2:])
# print(p1, p2)

if (1 <= p1 <= 12) or (1 <= p2 <= 12):
    if (1 <= p1 <= 12) and (1 <= p2 <= 12):
        print('AMBIGUOUS')
    elif 1 <= p1 <= 12:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(map(int,input()))
a=10*s[0]+s[1]
b=10*s[2]+s[3]
counta=0
countb=0
'''month'''
if 0<a<=12:
    counta+=1
if 0<b<=12:
    countb+=1
'''year'''
if a==0 or a>=13:
    counta+=5
if b==0 or b>=13:
    countb+=5
j=counta+countb
if j==2:
    print('AMBIGUOUS')
elif j==6 and counta==5:
    print('YYMM')
elif j==6 and countb==5:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
s = input()

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

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

Submission status: Accepted

Solution code:
s = input()

m = {str(i).zfill(2) for i in range(1,13)}
y = {str(i).zfill(2) for i in range(13,100)}

if s[:2] not in m and s[2:] in m:
  print('YYMM')
elif s[:2] in m and s[2:] not in m:
  print('MMYY')
elif s[:2] in m and s[2:] in m:
  print('AMBIGUOUS')
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 12 < a) and 1 <= b <= 12:
    print('YYMM')
elif 1 <= a <= 12 and (b == 0 or 12 < b):
    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:
  print('AMBIGUOUS')
elif 1<=a<=12:
  if 0 <= b <= 99:
    print('MMYY')
elif 1 <= b<= 12:
  if 0 <= a <= 99:
    print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
m = ["{:02}".format(i) for i in range(1, 13)]
s = input()
a = s[:2] in m
b = s[2:] in m
ans = "NA"

if a and b:
    ans = "AMBIGUOUS"
elif a:
    ans = "MMYY"
elif b:
    ans = "YYMM"

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def is_month(input_str):
  if 1 <= int(input_str) and int(input_str) <= 12:
    return True
  else:
    return False
    
def is_year(input_str):
  if 0 <= int(input_str) and int(input_str) <= 99:
    return True
  else:
    return False

s=input().strip()
first_half = [is_month(s[:2]), is_year(s[:2])]
second_half = [is_month(s[2:]), is_year(s[2:])]

if (first_half == [True, True] and second_half == [True, True]):
  print('AMBIGUOUS')
elif first_half[0] is True and second_half[1] is True:
  print('MMYY')
elif first_half[1] is True and second_half[0] is True:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
day = input()

aa = day[:2]
bb = day[2:]

if 1 <= int(aa) <= 12 and 1 <= int(bb) <= 12:
  print('AMBIGUOUS')
elif 1 <= int(aa) <= 12 and 0 <= int(bb) <= 99:
  print('MMYY')
elif 0 <= int(aa) <= 99 and 1 <= int(bb) <= 12:
  print('YYMM')
else:
  print('NA')

Submission status: Accepted

Solution code:
s = str(input())
f,l = int(s[0:2]),int(s[2:4])
k = 0
if 1 <= f <= 12:
  k += 1
if 1 <= l <= 12:
  k += 2
if k == 0:
  print("NA")
elif k == 1:
  print("MMYY")
elif k == 2:
  print("YYMM")
else:
  print("AMBIGUOUS")

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

import heapq

def main(): 

    S=list(input().split())
    S=list(S[0])
    if 0 < int(S[0]+S[1]) <= 12 and 0 < int(S[2]+S[3]) <= 12:
        print("AMBIGUOUS")
    elif 0 < int(S[0]+S[1]) <= 12:
        print("MMYY")
    elif 0 < int(S[2]+S[3]) <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
lst = list(input())
lst1 = []
lst1.append(lst[0]+lst[1])
lst1.append(lst[2]+lst[3])

if (int(lst1[0]) >=13 and int(lst1[1]) >=13) or (int(lst1[0]) >=13 and lst1[1] =="00") or (lst1[0] =="00" and int(lst1[1]) >=13) or (lst1[0] =="00" and lst1[1] == "00"):
  print("NA")
  
elif (0<int(lst1[0])<=12 and 0<int(lst1[1])<=12):
      print("AMBIGUOUS")
      
elif 0<int(lst1[0]) <=12:
      print("MMYY")
elif 0<int(lst1[1])<=12:
      print("YYMM")

Submission status: Accepted

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

def f(x):
	if x>0 and x<13:return True
	else: return False

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

Submission status: Accepted

Solution code:
S = input()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
S = input()
S1 = int(S[:2])
S2 = int(S[2:])
b1,b2 = False,False
if 1 <= S1 <= 12:
    b1 = True
if 1 <= S2 <= 12:
    b2 = True
print('AMBIGUOUS' if b1 and b2 else 'YYMM' if b2 else 'MMYY' if b1 else 'NA')

Submission status: Accepted

Solution code:
S = list(input())
A, B = int(S[0]+S[1]), int(S[2]+S[3])
if(0<A<13):
    if(0<B<13):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if(0<B<13):
        print("YYMM")
    else:
        print("NA")