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:
#coding:utf-8
s = int(input())

#上の2桁
up = s // 100
#下の2桁
down = s % 100

#AMBIGUOUS
if  up >= 1 and up <= 12 and down >=1 and down <= 12:
    print("AMBIGUOUS")
#NA
elif (up == 0 or up > 12 ) and (down == 0 or down > 12):
    print("NA")

#MMYY
elif up >= 1 and up <=12:
    print("MMYY")
#MMYY
else:
    print("YYMM")

Submission status: Accepted

Solution code:
S = list(input())

A = int(''.join(S[:2]))
B = int(''.join(S[2:]))

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

print(ans)

Submission status: Accepted

Solution code:
s = input()

y,m = int(s[:2]), int(s[2:])

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    S = input()
    s1, s2 = S[:2], S[2:]
    months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    if s1 in months and s2 in months:
        return "AMBIGUOUS"
    elif s1 in months:
        return "MMYY"
    elif s2 in months:
        return "YYMM"
    else:
        return "NA"

if __name__ == '__main__':
    print(main())

Submission status: Accepted

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


if __name__ == "__main__":
    test()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=input()
a=0
b=0
if(s[0]=='0' and s[1]!='0'):
  a=1
elif(s[0]=='1' and (s[1]=='0' or s[1]=='1' or s[2]=='2')):
  a=1

if(s[2]=='0' and s[3]!='0'):
  b=1
elif(s[2]=='1' and (s[3]=='0' or s[3]=='1' or s[3]=='2')):
  b=1
  
if(a==1 and b==1):
  print("AMBIGUOUS")
elif(a==1 and b==0):
  print("MMYY")
elif(a==0 and b==1):
  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"]

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

if s1 in M:
    if s2 in M:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif s2 in M:
    if s1 in M:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    print('NA')

Submission status: Accepted

Solution code:
s=input()
a=s[:2]
b=s[2:]
MMYY=0
YYMM=0

#MMYY
MMYY=1 if int(a)<=12 and int(a)>0 else 0
YYMM=1 if int(b)<=12 and int(b)>0 else 0

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

Submission status: Accepted

Solution code:
S = input()
fore = int(S[:2])
aft = int(S[2:])

if (fore == 0 or 13 <= fore <= 99) and 1 <= aft <= 12:
    print("YYMM")
elif 1 <= fore <= 12 and (aft == 0 or 13 <= aft <= 99):
    print("MMYY")
elif 1 <= fore <= 12 and 1 <= aft <= 12:
    print("AMBIGUOUS")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()
N=int(n[0]+n[1])
M=int(n[2]+n[3])
if 0<N<13 and 0<M<13:
    print("AMBIGUOUS")
elif 0<N<13:
    print("MMYY")
elif 0<M<13:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
#!/usr/bin/env python

def main():
    S = input()

    S1 = int(S[:2])
    S2 = int(S[2:])
    
    if 0 < S1 and S1 < 13 and 0 < S2 and S2 < 13:
        return 'AMBIGUOUS'
    elif 0 < S1 and S1 < 13:
        return 'MMYY'
    elif 0 < S2 and S2 < 13:
        return 'YYMM'
    else:
        return 'NA'

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
s = input()
seq = list(map(int, (s[:2], s[2:])))

ans = ["", ""]

for i in range(2):
    if 0 < seq[i] <= 12:
        ans[i] = "MM"
    else:
        ans[i] = "YY"

if "MM" not in ans:
    print("NA")
elif "YY" not in ans:
    print("AMBIGUOUS")
else:
    print("".join(ans))

Submission status: Accepted

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

S = input()
first = int(S[0:2])
last = int(S[2::])
 
if first >= 1 and first <= 12:
    if last >= 1 and last <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if last >= 1 and last <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
S = int(input())
A = S // 100
B = S % 100
MMA = False
MMB = False
if 1 <= A and A <= 12:
  MMA = True
if 1 <= B and B <= 12:
  MMB = True

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

Submission status: Accepted

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

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:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################


S = str(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
S = list(input())
FF = ''
RR = ''
J = [0] * 2

for st in S[0],S[1]:
	FF += st

for st in S[2],S[3]:
	RR += st

if 1 <= int(FF) <= 12:
	J[0] = 1
else:
	J[0] = 0

if 1 <= int(RR) <= 12:
	J[1] = 1
else:
	J[1] = 0

if J[0] == 0 and J[1] == 0:
	print('NA')
elif J[0] == 0 and J[1] == 1:
	print('YYMM')
elif J[0] == 1 and J[1] == 0:
	print('MMYY')
else:
	print('AMBIGUOUS')

Submission status: Accepted

Solution code:
information=input()
first=information[:2]
second=information[2:]

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


if first in monthlist and second in monthlist:
    print("AMBIGUOUS")
elif first in monthlist:
    print("MMYY")
elif second in monthlist:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
a, b = s//100, s%100
p = bool(1 <= a <= 12)
q = bool(1 <= b <= 12)
if p & q:
    print("AMBIGUOUS")
elif p:
    print("MMYY")
elif q:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

n1 = s[0]*10 + s[1]
n2 = s[2]*10 + s[3]

if n1 > 0 and n1 <=12:
    if n2 > 0 and n2 <= 12:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if n2 > 0 and n2 <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
s = input()
first = int("".join(s[:2]))
last = int("".join(s[2:]))

if first > 0 and first <=12:
  if last > 0 and last <= 12:
    ans = 'AMBIGUOUS'
  else:
    ans = 'MMYY'
else:
  if last > 0 and last <= 12:
    ans = 'YYMM'
  else:
    ans = 'NA'
print(ans)

Submission status: Accepted

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

s = input().strip()

aa = int(s[:2])
bb = int(s[2:])

if 0 < aa and aa <= 12 and 0 < bb and bb <= 12:
    print("AMBIGUOUS")
elif 0 < aa and aa <= 12:
    print("MMYY")
elif 0 < bb and bb <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s=input()

def is_month(s):
  return 0 < int(s) < 13

s1_is_month = is_month(s[:2])
s2_is_month = is_month(s[2:])

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

Submission status: Accepted

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

def is_month(s):
  return 0 < int(s) < 13

s1_is_month = is_month(s1)
s2_is_month = is_month(s2)

if s1_is_month or s2_is_month:
  if s1_is_month and not s2_is_month:
    print('MMYY')
  elif not s1_is_month and s2_is_month:
    print('YYMM')
  else:
    print('AMBIGUOUS')
elif not is_month(s1) and not is_month(s2):
  print('NA')

Submission status: Accepted

Solution code:
import math
import copy

inputa = input().split()
# inputb = input().split()

# a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

a = inputa[0]
inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)

tmptop = [inputList[0], inputList[1]]
tmpjointop = "".join(tmptop)
top = int(tmpjointop)

tmpbottom = [inputList[2], inputList[3]]
tmpjoinbottom = "".join(tmpbottom)
bottom = int(tmpjoinbottom)

flgFrontMM = True
flgTermMM = True

if top > 12 or top == 0:
    flgFrontMM = False

if bottom > 12 or bottom == 0:
    flgTermMM = False

if flgFrontMM and flgTermMM:
    print("AMBIGUOUS")
elif flgFrontMM == False and flgTermMM == False:
    print("NA")
elif flgFrontMM:
    print("MMYY")
elif flgTermMM:
    print("YYMM")

Submission status: Accepted

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

Submission status: Accepted

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

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

if ismonth(S1):
    if ismonth(S2):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if ismonth(S2):
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

Solution code:
s=input()
a=s[:2]
b=s[2:]
#print(a)
#print(b)
month=["01","02","03","04","05","06","07","08","09","10","11","12"]
at=(a in month)
bt=(b in month)

if at and bt:
    print("AMBIGUOUS")
elif at:
    print("MMYY")
elif bt:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()
hantei1 = 0
hantei2 = 0

S1 = int(S[0] + S[1])
S2 = int(S[2] + S[3])

if S1 > 0 and S1 <13 :
    hantei1 = 1
if S2 > 0 and S2 <13 :
    hantei2 = 1

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
data=list(input())
a=10*int(data[0])+int(data[1])
b=10*int(data[2])+int(data[3])

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

Submission status: Accepted

Solution code:
s=input()
sf=int(s[:2])
sl=int(s[2:])

if (sf>12 or sf==0) and sl<=12 and 0!=sl:
  print("YYMM")
elif (sl>12 or sl==0) and sf<=12 and 0!=sf:
  print("MMYY")
elif sf<=12 and sl<=12 and sf*sl!=0:
  print("AMBIGUOUS")
else:
  print("NA")

Submission status: Accepted

Solution code:
s = input()
s_first = int(s[:2])
s_second = int(s[2:]) 

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

Submission status: Accepted

Solution code:
s = list(input())
s_first = int("".join(s[:2])) 
s_second = int("".join(s[2:])) 

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

Submission status: Accepted

Solution code:
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])
YY = list(range(100))
MM = list(range(1,13))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = str(input())

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

Submission status: Accepted

Solution code:
def solve():
    s = input()
    yy_or_mm = int(s[:2])
    mm_or_yy = int(s[2:])
    if is_month(yy_or_mm) and is_month(mm_or_yy):
        return "AMBIGUOUS"
    elif not is_month(yy_or_mm) and is_month(mm_or_yy):
        return "YYMM"
    elif is_month(yy_or_mm) and not is_month(mm_or_yy):
        return "MMYY"
    elif not is_month(yy_or_mm) and not is_month(mm_or_yy):
        return "NA"


def is_month(mm):
    return 1 <= mm <= 12


if __name__ == "__main__":
    print(solve())

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = input().split()[0]

# YYMMの可能性がある
format_list = []

if 1 <= int(s[:2]) <= 12:
    format_list.append('MMYY')

if 1 <= int(s[2:]) <= 12:
    format_list.append('YYMM')

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

print(ans)

Submission status: Accepted

Solution code:
def is_month(s):
    if 1 <= int(s) and int(s) <= 12:
        return 1
    else:
        return -1

s = list(input())

before = s[0] + s[1]

after = s[2] + s[3]

ret_b = is_month(before)
ret_a = is_month(after)

if ret_b == 1 and ret_a == 1:
    print("AMBIGUOUS")
elif ret_b == 1 and ret_a == -1:
    print("MMYY")
elif ret_b == -1 and ret_a == 1:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
s = int(input())

xx__ = s//100
__xx = s%100

if xx__ > 0 and xx__ < 13:
    if __xx > 0 and __xx < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if __xx > 0 and __xx < 13:
        print('YYMM')
    else:
        print('NA')

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=list(map(int,input()))
x=s[0]*10+s[1]
y=10*s[2]+s[3]
if x>12 and y>0 and y<=12:
  print("YYMM")
elif x>0 and x<=12 and y>12:
  print("MMYY")
elif x<=12 and x>0 and y>0 and y<=12:
  print("AMBIGUOUS")
elif x==0 and y<=12 and y>0:
  print("YYMM")
elif y==0 and x>0 and x<=12:
  print("MMYY")
else:
  print("NA")

Submission status: Accepted

Solution code:

# YYMM or MMYY
S = int(input())

A = S // 100
B = S - (A* 100)
# YY確認
if 1 <= A <= 12:
    if 13 <= B <= 99 or B == 0:
        print('MMYY')
    else:  #1 <= B <= 12
        print('AMBIGUOUS')
elif 1 <= B <= 12:
    if 13 <= A <=99 or A == 0:
        print('YYMM')
    else: #1 <= B <= 12
        print('AMBIGUOUS')
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
l=[i for i in str(input())]
A=int(''.join(l[:2]))
B=int(''.join(l[2:]))

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

Submission status: Accepted

Solution code:
s = list(input())
f = int(''.join(s[:2]))
r = int(''.join(s[2:]))
yymm = 0
mmyy = 0
if 0 <= f and f <= 99:
    if 1<=r and r<= 12:
        yymm = 1
if 1<=f and f<= 12:
    if 0 <= r and r <= 99:
        mmyy = 1
if mmyy == 1 and yymm == 1:
    print('AMBIGUOUS')
elif mmyy == 0 and yymm == 1:
    print('YYMM')
elif mmyy == 1 and yymm == 0:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
A=input()
S=[int(A[i:i+2]) for i in range(0,len(A),2)]
if 1<=S[0] and S[0]<=12:
    if 1<=S[1] and S[1]<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=S[1] and S[1]<=12:
        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("YYMM")
elif 1 <= int(s[:2]) <= 12:
    print("MMYY")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coding: utf-8

S = input()


def valid_my(mon, day):
    m = int(mon)

    if m <= 0 or 13 <= m:
        return False
    return True

def valid_ym(year, mon):
    y = int(year)
    m = int(mon)

    if m <= 0 or 13 <= m:
        return False

    return True


A = S[:2]
B = S[2:]

my = valid_my(A, B)
ym = valid_ym(A, B)

if my and ym:
    print("AMBIGUOUS")
elif my:
    print("MMYY")
elif ym:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def between12(m):
    if 0 < m <= 12:
        return True
    else:
        return False

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

if between12(left):
    if between12(right):
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
else:
    if between12(right):
        print('YYMM')
        exit()

print('NA')

Submission status: Accepted

Solution code:

def between12(m):
    if 0 < m <= 12:
        return True
    else:
        return False

S = input()
left = int(S[0] + S[1])
right = int(S[2] + S[3])

if between12(left):
    if between12(right):
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
else:
    if between12(right):
        print('YYMM')
        exit()

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 1<= b <= 12:
    print('YYMM')
elif 1<= a <= 12:
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input()
before = S[:2]
after = S[2:]
a = int(after)
b = int(before)

a_flg = False
b_flg = False
if 1 <= a and a <= 12:
  a_flg = True
if 1 <= b and b <= 12:
  b_flg = True

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

Submission status: Accepted

Solution code:
ym=input()
y=ym[:2]
m=ym[2:]
ys=[str(i).zfill(2) for i in range(100)]
ms=[str(i).zfill(2) for i in range(1,13)]
if (y in ys) and (m in ms) and (y in ms) and (m in ys):
    print('AMBIGUOUS')
elif y in ms and m in ys:
    print('MMYY')
elif y in ys and m in ms:
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def to_int(i):
    if i[0] == 0:
        return int(i[1])
    else:
        return int(i)

a = to_int(a)
b = to_int(b)

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

Submission status: Accepted

Solution code:
s = input()

if 1 <= int(s[0:2]) < 13:
	if 1 <= int(s[2:4]) < 13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 1 <= int(s[2:4]) < 13:
		print("YYMM")
	else:
		print("NA")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = input()

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

a = (1 <= left <= 12)
b = (1 <= right <= 12)

if a and b:
    ans = 'AMBIGUOUS'
elif a:
    ans = 'MMYY'
elif b:
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)

Submission status: Accepted

Solution code:
a=int(input())

u = int(a /100)
l = a%100

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

Submission status: Accepted

Solution code:
def is_month(s):
    return 1 <= int(s) and int(s) <= 12


s = input()

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

if is_month(first) and is_month(second):
    print('AMBIGUOUS')
elif is_month(first) and not is_month(second):
    print('MMYY')
elif not is_month(first) and is_month(second):
    print('YYMM')
else:
    print('NA')

Submission status: Accepted

Solution code:
s=int(input())
s1=s//100
s2=s-s1*100
if 0<s1<=12 and 0<s2<=12:
    print("AMBIGUOUS")
elif 0<s1<=12:
    print("MMYY")
elif 0<s2<=12:
    print("YYMM")
else:
    print("NA")

Submission status: Accepted

Solution code:
num = input()
num_1 = int(num[0:2])
num_2 = int(num[2:4])
ans = ["AMBIGUOUS", "MMYY", "YYMM", "NA"]
flag = 3
if 1 <= num_1 and num_1 <= 12:
  if 1 <= num_2 and num_2 <= 12:
    flag = 0
  else:
    flag = 1
else:
  if 1 <= num_2 and num_2 <= 12:
    flag = 2

print(ans[flag])

Submission status: Accepted

Solution code:
def main():
    S = input()
    month_0 = True
    month_1 = True

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

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


if __name__ == '__main__' :
    main()

Submission status: Accepted

Solution code:
s = input()
first = int(s[:2])
second = int(s[2:])

if((first > 12 or first == 0) and second <= 12 and second != 0):
	print("YYMM")
elif(first <= 12 and (second > 12 or second == 0) and first != 0):
	print("MMYY")
elif(first <= 12 and second <= 12 and second != 0 and second != 0):
	print("AMBIGUOUS")
else:
	print("NA")

Submission status: Accepted

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

Submission status: Accepted

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

judge = [0]*4

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
S =str(input())
top = int(S[:2])
bot = int(S[-2:])

if 1<= top <= 12:
    if 1 <= bot <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= bot <= 12:
        print("YYMM")
    else:
        print("NA")

Submission status: Accepted

Solution code:
s = list(input())
a = int(s[0]+s[1])
b = int(s[2]+s[3])
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()
s1 = int(s[0: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()
MM = ['%02i' % mm for mm in range(1, 12+1)]

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

Submission status: Accepted

Solution code:
N = list(input())
m = list(map(int,N))
a = 10*m[0] + m[1]
b = 10*m[2] + m[3]
 
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()
first = int(S[0:2])
second = int(S[2:])

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

Submission status: Accepted

Solution code:
x=int(input())

y=x//100
m=x-y*100

if y>0 and y<13:
	if m>0 and m<13:
		res='AMBIGUOUS'
	else:
		res='MMYY'
else:
	if m>0 and m<13:
		res='YYMM'
	else:
		res='NA'

print(res)

Submission status: Accepted

Solution code:
x = input().strip()
n = int(x[:2])
m = int(x[2:])
#print(n)
#print(m)

if n>=1 and n<=12 and m>=1 and m<=12:
    print('AMBIGUOUS')
elif  (n<1 or n>12) and m>=1 and m<=12 :
    print('YYMM')
elif n>=1 and n<=12 and (m<1 or m>12):
    print('MMYY')
else:
    print('NA')

Submission status: Accepted

Solution code:
S = input().strip()
first = int(S[:2])
second = int(S[2:])

def isMonth(n):
  return 1 <= n <= 12

if isMonth(first) and isMonth(second):
  print('AMBIGUOUS')
elif not(isMonth(first)) and isMonth(second):
  print('YYMM')
elif isMonth(first) and not(isMonth(second)):
  print('MMYY')
else:
  print('NA')

Submission status: Accepted

Solution code:
S = input()

s1, s2 = int(S[:2]), int(S[2:])

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

Submission status: Accepted

Solution code:
S = input()

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

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