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.

Solution (Python):
str     = input()

input   = int(str)

if input < 100:
    if input ==0:
        out = 'NA'
    elif input < 13:
        out = 'YYMM'
    else:
        out = 'NA'
elif input < 1300:
    if input % 100 == 0:
        out = 'MMYY'
    elif input%100 < 13:
        out = 'AMBIGUOUS'
    else:
        out = 'MMYY'
elif input%100==0:
    out = 'NA'
elif input%100<13:
    out = 'YYMM'
else:
    out = 'NA'
print(out)

Solution (Python):

S = input()

uS = S[:2]
lS = S[2:]

uNum = int(uS)
lNum = int(lS)

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

Solution (Python):
S = input()

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

if(s1 <= 12 and s2 <= 12 and s1 is not 0 and s2 is not 0):
    print('AMBIGUOUS')
elif(s1 <= 12 and s2 > 12 and s1 is not 0):
    print('MMYY')
elif(s1 > 12 and s2 <= 12 and s2 is not 0):
    print('YYMM')
elif(s1 is 0 and s2 <= 12 and s2 is not 0):
    print('YYMM')
elif(s1 <= 12 and s2 is  0 and s1 is not 0):
    print('MMYY')
else:
    print('NA')

Solution (Python):
'''
長さ 4 の数字列 S が与えられます。あなたは、この数字列が以下のフォーマットのどちらであるか気になっています。

YYMM フォーマット: 西暦年の下 2 桁と、月を 2 桁で表したもの (例えば 1 月なら 01) をこの順に並べたものMMYY フォーマット: 月を 2 桁で表したもの 
(例えば 1 月なら 01) と、西暦年の下 2 桁をこの順に並べたもの与えられた数字列のフォーマットとして考えられるものが YYMM フォーマットのみである場合 YYMM を、 
MMYY フォーマットのみである場合 MMYY を、 YYMM フォーマット と MMYY フォーマットのどちらの可能性もある場合 AMBIGUOUS を、 どちらの可能性もない場合 NA を出力してください。
'''

def main():
	'''
	メイン関数
	'''
	
	S = input()

	
	mae = S[0] + S[1]
	ushiro = S[2] + S[3]

	m_M_flag = False
	u_M_flag = False

	if int(mae) > 0 and int(mae) < 13 :
		m_M_flag = True
		
	if int(ushiro) > 0 and int(ushiro) < 13 :
		u_M_flag = True

	if m_M_flag and u_M_flag:
		print("AMBIGUOUS")
	elif m_M_flag and not u_M_flag:
		print("MMYY")
	elif not m_M_flag and u_M_flag:
		print("YYMM")
	elif not m_M_flag and not u_M_flag:
		print("NA")
	


if __name__ == '__main__':
	main()

Solution (Python):
num = input()
num1 = int(num[0] + num[1])
num2 = int(num[2] + num[3])

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

Solution (Python):
S = input()

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

Solution (Python):
S = input()

A = 10 * int(S[0]) + int(S[1])
B = 10 * int(S[2]) + int(S[3])




flag_YYMM = 0
flag_MMYY = 0

if 1 <= A and A <= 12 : 
    flag_MMYY = 1
if 1 <= B and B <= 12 : 
    flag_YYMM = 1
    
if flag_YYMM == 0 and flag_MMYY == 0 : 
    print("NA")
elif flag_YYMM == 0 and flag_MMYY == 1 : 
    print("MMYY")
elif flag_YYMM == 1 and flag_MMYY == 0 : 
    print("YYMM")
elif flag_YYMM == 1 and flag_MMYY == 1 : 
    print("AMBIGUOUS")

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


if s1 >= 1 and s1 <= 12:
	if s2 >= 1 and s2 <= 12:
		print('AMBIGUOUS')
	else:
		print('MMYY')

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

Solution (Python):
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')

Solution (Python):
from sys import stdin

s = stdin.readline().strip()
left, right = int(s[:2]), int(s[2:])
if 1 <= left <= 12 and 1 <= right <= 12:
  print('AMBIGUOUS')
elif 1 <= left <= 12 and 0 <= right <= 99:
  print('MMYY')
elif 0 <= left <= 99 and  1 <= right <= 12:
  print('YYMM')
else:
  print('NA')

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

Solution (Python):
a=list(map(int,input()))
b,c=a[0]*10+a[1],a[2]*10+a[3]
if 1<=b<=12:
    if 1<=c<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 1<=c<=12:
    print("YYMM")
else:
    print("NA")

Solution (Python):
s = str(input())
mae = int(s[:2])
usiro = int(s[2:])
if 0 < mae < 13:
    if 0 <usiro < 13:
        print("AMBIGUOUS")
    else:
         print("MMYY")
elif 0 < usiro < 13:
         print("YYMM")
else:
    print("NA")

Solution (Python):
s = input()

num1 = int(s[:2])
num2 = int(s[2:])

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

if month(num1) == True and month(num2) == True:
    print('AMBIGUOUS')
elif month(num1) == True and month(num2) == False:
    print('MMYY')
elif month(num1) == False and month(num2) == True:
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
s = input()
s1 = s[0:2]
s2 = s[2:4]

i1 = int(s1)
i2 = int(s2)
 
if 1 <= i1 <=12 and 1 <= i2 <= 12:
    res = "AMBIGUOUS"
elif 1 <= i1 <= 12:
    res = "MMYY"
elif 1 <= i2 <= 12:
    res = "YYMM"
else:
    res = "NA"

print(res)

Solution (Python):


S = input()







if S[0:2] < '13' and S[0:2] != '00' :
    if S[2:4] < '13' and S[2:4] != '00' :
        print('AMBIGUOUS')
    else :
        print('MMYY')

else:
    if S[2:4] < '13' and S[2:4] != '00' :
        print('YYMM')
    else :
        print('NA')

Solution (Python):
ans = ('YYMM', 'MMYY', 'AMBIGUOUS', 'NA')

s = input()

if (1 <= int(s[0:2]) and int(s[0:2]) <= 12) and (1 <= int(s[2:4]) and int(s[2:4]) <= 12):
    print(ans[2])
elif 1 <= int(s[0:2]) and int(s[0:2]) <= 12:
    print(ans[1])
elif 1 <= int(s[2:4]) and int(s[2:4]) <= 12:
    print(ans[0])
else:
    print(ans[3])

Solution (Python):

s = raw_input()


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

if first in range(1, 12+1):
    if second in range(1, 12+1):
        print "AMBIGUOUS"
    else:
        print "MMYY"
elif second in range(1, 12+1):
    print "YYMM"
else:
    print "NA"

Solution (Python):
def m(suu):
  if suu>=1 and suu<=12:
    return True
  else:
    return False

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

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

Solution (Python):
def main():
    s = list(input())
    left = int(s[0] + s[1])
    right = int(s[2] + s[3])

    if 1 <= left and left <= 12:
        if 1 <= right and right <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"
    else:
        if 1 <= right and right <= 12:
            return "YYMM"
        else:
            return "NA"

print(main())

Solution (Python):
S = raw_input()
a = S[0]+S[1]
b = S[2]+S[3]
yymm = 1 <= int(b) and int(b) <= 12
mmyy = 1 <= int(a) and int(a) <= 12
if yymm:
	if mmyy: print 'AMBIGUOUS'
	else: print 'YYMM'
else:
	if mmyy: print 'MMYY'
	else: print 'NA'

Solution (Python):
s = input()
head = int(s[:2])
tail = int(s[2:])

head_M = 1 <= head <= 12
tail_M = 1 <= tail <= 12

if head_M and tail_M:
  ret = 'AMBIGUOUS'
elif head_M:
  ret = 'MMYY'
elif tail_M:
  ret = 'YYMM'
else:
  ret = 'NA'
print(ret)

Solution (Python):
S = input()
s_1 = int(S[:2])
s_2 = int(S[2:])

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

Solution (Python):
def main() -> None:
    S = input()
    a = S[:2]
    b = S[2:]
    if ('00' < a < '13') and ('00' < b < '13'):
        print("AMBIGUOUS")
    elif '00' < a < '13':
        print("MMYY")
    elif '00' < b < '13':
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Solution (Python):



S = input()

A = int(S[0:2])
B = int(S[2:])
f1,f2 = False,False
if A > 0 and A <= 12:
    f1 = True
if B > 0 and B <= 12:
    f2 = True

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

Solution (Python):
S = input()

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

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

Solution (Python):
n = int(input())

a = n // 100
b = n % 100

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

Solution (Python):
a = input()
p = int(a[0:2])
q = int(a[2:4])
if p == 0:
    if q == 0 or q > 12:
        print("NA")
    else:
        print("YYMM")
elif q == 0:
    if p == 0 or p > 12:
        print("NA")
    else:
        print("MMYY")
else:
    if p > 12 and q > 12:
        print("NA")
    elif p <= 12 and q <= 12:
        print("AMBIGUOUS")
    elif p <= 12 and q > 12:
        print("MMYY")
    elif q <= 12 and p > 12:
        print("YYMM")

Solution (Python):

s=int(input())
supper=s//100
sunder=s-(s//100)*100
if 1<=supper<=12 and 1<=sunder<=12:
    print("AMBIGUOUS")
elif 1<=supper<=12:
    print("MMYY")
elif 1<=sunder<=12:
    print("YYMM")
else:
    print("NA")

Solution (Python):
n = input()

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

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

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

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

Solution (Python):
n = input()
a = 1<=int(n[0:2])<=12
b = 1<=int(n[2:4])<=12
if a and b:
    print("AMBIGUOUS")
elif a:
    print("MMYY")
elif b:
    print("YYMM")
else:
    print("NA")

Solution (Python):
def yymm():
    num = input()
    former = num[:2]
    latter = num[2:]

    former = int(former)
    latter = int(latter)
    
    

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

if __name__ == '__main__':
    yymm()

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

Solution (Python):
import sys

s = input()

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


if ((former > 12 or former==0) and (latter <= 12 and latter > 0)):
    print('YYMM')
    sys.exit()


if ((former <= 12 and former > 0) and (latter > 12 or latter==0)):
    print('MMYY')
    sys.exit()


if ((former <= 12 and former > 0) and (latter <= 12 and latter > 0)):
    print('AMBIGUOUS')
    sys.exit()


print('NA')

Solution (Python):
n = int(input())
a = n // 100
b = n % 100

if a ==0 or (13 <=a<=99):
    if 1<=b<=12:
        ans = 'YYMM'
    else:
        ans = 'NA'
else:
    if b==0 or (13 <=b<=99):
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'


print(ans)

Solution (Python):


inputLine = input()

firstPart = int(inputLine[0:2])
secondPart = int(inputLine[2:4])


naFlag = False
firstPartYear = False
firstPartAmb = False
secondPartYear = False
secondPartAmb = False


if firstPart < 0:
    naFlag = True

elif firstPart == 0:
    firstPartYear = True
    
elif firstPart < 13:
    firstPartAmb = True
    
else: 
    firstPartYear = True
    

if secondPart < 0:
    naFlag = True

elif secondPart == 0:
    secondPartYear = True
    
elif secondPart < 13:
    secondPartAmb = True
    
else: 
    secondPartYear = True
    
if naFlag:
    print('NA')

elif secondPartYear:
    if firstPartYear:
        print('NA')
    elif firstPartAmb:
        print('MMYY')

elif secondPartAmb:
    if firstPartYear:
        print('YYMM')
    elif firstPartAmb:
        print('AMBIGUOUS')

Solution (Python):
import sys
import math
import collections
import itertools
import array
import inspect


sys.setrecursionlimit(1000000)



def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))



def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v

def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False



dp = None


def main():
    S = input()

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

    front_mm = 1 <= front <= 12
    rear_mm = 1 <= rear <= 12

    if front_mm and rear_mm:
        print("AMBIGUOUS")
    elif front_mm:
        print("MMYY")
    elif rear_mm:
        print("YYMM")
    else:
        print("NA")


main()

Solution (Python):
S = input()
month_list = ['0' + str(ii) for ii in range(1, 10)]
month_list.extend(['10', '11', '12'])

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

Solution (Python):
S = input()

S_list = list(S)
S_1 = int(S_list[0]+S_list[1])
S_2 = int(S_list[2]+S_list[3])

if S_1==0 or (13<=S_1<=99):
    if 1<=S_2<=12:
        ans = 'YYMM'
    else:
        ans = 'NA'
else:
    if S_2==0 or (13<=S_2<=99):
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'
        
print(ans)

Solution (Python):
def solve(s):
  a = s // 100
  b = s % 100
  
  if 0 < a <= 12 and 0 < b <= 12:
    return "AMBIGUOUS"
  elif 0 < a <= 12:
    return "MMYY"
  elif 0 < b <= 12:
    return "YYMM"
  else:
    return "NA"

s = int(input())

print(solve(s))

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

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

Solution (Python):
S = input()
low = int(S) % 100
high = (int(S) - low) / 100

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

Solution (Python):


s = input()
prefix = int(s[:2])
suffix = int(s[2:])

def isMonth(n):
    if n <= 12 and n >= 1:
        return True

if isMonth(prefix) and isMonth(suffix):
    ans = 'AMBIGUOUS'
elif not isMonth(prefix) and isMonth(suffix):
    ans = 'YYMM'
elif isMonth(prefix) and not isMonth(suffix):
    ans = 'MMYY'
else:
    ans = 'NA'

print(ans)

Solution (Python):
YM = input()
left = int(YM) // 100
right = int(YM) % 100

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

Solution (Python):
inp = input()
inp = int(inp)

ans = 3

s_up = inp // 100
s_do = inp - s_up * 100

if (s_up > 12) or (s_up == 0):
    ans = 1

if (s_do > 12) or (s_do == 0):
    ans = 2

if ((s_up > 12) or (s_up == 0)) and ((s_do > 12) or (s_do == 0)):
    ans = 4

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

Solution (Python):





s = input()
pre = int(s[:2])
last = int(s[2:])

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

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

Solution (Python):
i=input()
a,b=int(i[:2]),int(i[-2:])
def x(n):
    if n>12 or n==0:return True
def y(n):
    if n<13 and n!=0:return True
if y(a) and y(b):
    print ("AMBIGUOUS")
if y(a) and x(b):
    print ("MMYY")
if x(a) and y(b):
    print ("YYMM")
if x(a) and x(b):
    print ("NA")

Solution (Python):
N = input()
S_2, S_4 = int(N[:2]), int(N[2:])
if 1 <= S_2 <= 12 and 1 <= S_4 <= 12:
    print("AMBIGUOUS")
elif 1 <= S_2 <= 12 and (S_4 < 1 or S_4 > 12):
    print("MMYY")
elif (S_2 < 1 or S_2 > 12) and 1 <= S_4 <= 12:
    print("YYMM")
else:
    print("NA")

Solution (Python):

S = input()

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

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

Solution (Python):
s = str(input())

yy = int(s[0:2])
mm = int(s[2:4])

mf1 = False
mf2 = False

if 0 < yy < 13 :
    mf1 = True
if 0 < mm < 13 :
    mf2 = True

if mf1 and mf2 :
    print('AMBIGUOUS')
elif mf1 and not mf2 :
    print('MMYY')
elif not mf1 and mf2 :
    print('YYMM')
elif not mf1 and not mf2 :
    print('NA')

Solution (Python):
s=str(input())
a=int(s[:2])
b=int(s[2:])
if a==0 or a>=13:
    astr='YY'
else:
    astr='MM'

if b==0 or b>=13:
    bstr='YY'
else:
    bstr='MM'

ans=astr+bstr


if ans=='YYYY':
    print('NA')
elif ans=='MMMM':
    print('AMBIGUOUS')
else:
    print(ans)

Solution (Python):





















s = input()

s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

if 0<s1<13 and 0<s2<13:
    print("AMBIGUOUS")

elif not(0<s1<13) and 0<s2<13:
    print("YYMM")

elif 0<s1<13 and not(0<s2<13):
    print("MMYY")

else:
    print("NA")

Solution (Python):
y=input()
v = [y[i: i+2] for i in range(0, len(y), 2)]

a=''
b=''

if int(v[0])>=1 and int(v[0])<=12:
	a='YYorMM'
elif int(v[0])>=13 or int(v[0])==0:
	a='YY'
    
if int(v[1])>=1 and int(v[1])<=12:
	b='YYorMM'
elif int(v[1])>=13 or int(v[1])==0:
	b='YY'

result=''
if a=='YY' and b=='YYorMM':
	result="YYMM"
elif  a=='YY' and b=='YY':
	result="NA"
elif  a=='YYorMM' and b=='YY':
	result="MMYY"
elif  a=='YYorMM' and b=='YYorMM':
	result="AMBIGUOUS"
else:
	result="ERROR"
    
print(result)

Solution (Python):
s = input()
a, b = int(s[:2]), int(s[2:])
ch = 0
if 0 < a < 13:
    ch += 1
if 0 < b < 13:
    ch += 2
if ch == 0:
    print("NA")
elif ch == 1:
    print('MMYY')
elif ch == 2:
    print('YYMM')
elif ch == 3:
    print('AMBIGUOUS')

Solution (Python):
t = input()
A, B = int(t[:2]), int(t[2:])
def V(k):
    return 1 <= k <= 12
ans = "NA"
if V(A) or V(B):
    if V(A) and V(B):
        ans = "AMBIGUOUS"
    elif V(A):
        ans = "MMYY"
    else:
        ans = "YYMM"
print(ans)

Solution (Python):
s = input()

s1 = int(s[0]+s[1])
s2 = int(s[2]+s[3])

if 0<s1<13 and 0<s2<13:
    print("AMBIGUOUS")

elif not(0<s1<13) and 0<s2<13:
    print("YYMM")

elif 0<s1<13 and not(0<s2<13):
    print("MMYY")

else:
    print("NA")

Solution (Python):
S = list(input())
S_divide = [S[0]+S[1],S[2]+S[3]]
S_divide = list(map(int, S_divide))
a = S_divide[0]
b = S_divide[1]
while True:
    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')
    break

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

MMYY = (1 <= int(a) <= 12) and (0 <= int(b) <= 99)
YYMM = (0 <= int(a) <= 99) and (1 <= int(b) <= 12)

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

Solution (Python):
s = input()
first = int(s[0:2])
second = int(s[2:4])
if 1 <= first <= 12 and 1 <= second <= 12:
    print('AMBIGUOUS')
elif 1 <= first <= 12:
    print('MMYY')
elif 1 <= second <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
def num_checker(string1, string2):
    if (int(string1)==0 and int(string2) != 0) or 9 < int(string1 + string2) < 13:
        return True
    else:
        return  False

S = input()
if num_checker(list(S)[0], list(S)[1]):
    if num_checker(list(S)[2], list(S)[3]):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if num_checker(list(S)[2], list(S)[3]):
        print("YYMM")
    else:
        print("NA")

Solution (Python):


A = str(input())
B =int(A[:2])
C =int(A[2:4])


if B >=1 and B<=12:
    B_mm = True
else:
    B_mm = False

if C >=1 and C<=12:
    C_mm = True
else:
    C_mm = False

if B >=0 and B<=99:
    B_yy = True
else:
    B_yy = False

if C >=0 and C<=99:
    C_yy = True
else:
    C_yy = False

if B_yy == True and C_mm == True and B_mm ==True and C_yy ==True:
    print('AMBIGUOUS')
elif B_yy == True and C_mm == True:
    print('YYMM')
elif C_yy == True and B_mm == True:
    print('MMYY')
else:
    print('NA')

Solution (Python):
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')

Solution (Python):
s = input()
first = int(s[0:2])
second = int(s[2:4])
if 1 <= first <= 12 and 1 <= second <= 12:
    print('AMBIGUOUS')
elif 1 <= first <= 12:
    print('MMYY')
elif 1 <= second <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
import sys

def main():
    input = sys.stdin.readline
    S = int(input())

    a = S // 100
    b = S % 100

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


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

Solution (Python):
import sys 

S = sys.stdin.readline()

def is_mmyy(s):
    former, latter = int(S[0:2]), int(S[2:])
    if former >= 1 and former <= 12:
        return True
    return False

def is_yymm(s):
    former, latter = int(S[0:2]), int(S[2:])
    if latter >= 1 and latter <= 12:
        return True
    return False



if is_mmyy(S) and is_yymm(S):
    print("AMBIGUOUS")

elif is_mmyy(S):
    print("MMYY")

elif is_yymm(S):
    print("YYMM")
else:
    print("NA")

Solution (Python):
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
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")

Solution (Python):
s = input()

def is_yymm(s):
    y, m = int(s[:2]), int(s[2:])
    return True if m > 0 and m < 13 else False

def is_mmyy(s):
    m, y = int(s[:2]), int(s[2:])
    return True if m > 0 and m < 13 else False

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

Solution (Python):
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")

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

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

Solution (Python):
def determin_format(A, B):
    if 0<  A <= 12:
        if 0 <  B <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"
    
    else:
        if 0 <  B <= 12:
            return "YYMM"
        else: 
            return  "NA"

S = input()

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

print(determin_format(A,B))

Solution (Python):
def inpl(): return list(map(int, input().split()))

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

Solution (Python):
S=input()
list=[]
for i in S:
    list.append(i)
num_for=int(list[0]+list[1])
num_lat=int(list[2]+list[3])

def yymm_jud(x):
    if 0<x<13:
        return 1
    else:
        return 0
def mmyy_jud(x):
    if 0<x<13:
        return 1
    else:
        return 0

if yymm_jud(num_lat)==1 and mmyy_jud(num_for)==0:
    print("YYMM")
elif yymm_jud(num_lat)==0 and mmyy_jud(num_for)==1:
    print("MMYY")
elif yymm_jud(num_lat)==0 and mmyy_jud(num_for)==0:
    print("NA")
else:
    print("AMBIGUOUS")

Solution (Python):
print(["NA","YYMM","MMYY","AMBIGUOUS"][(lambda x:(0<x//100<13)*2+(0<x%100<13))(int(input()))])

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

Solution (Python):
a = input()

flag1 = False
flag2 = False
k = int(a[:2])
l = int(a[2:])
if k is not 0 and k < 13:
    flag1 = True
if l is not 0 and l < 13:
    flag2 = True

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

Solution (Python):
def isMM(s):
  n = int(s)
  if 0 < n <13:
    return True
  return False

s = raw_input()
s1 = s[:2]
s2 = s[2:]
ans = "NA"
if isMM(s2):
  if isMM(s1):
    ans = "AMBIGUOUS"
  else:
    ans = "YYMM"
else:
  if isMM(s1):
    ans = "MMYY"
    
print ans

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


def is_month(n):
    return n > 0 and n <= 12


if is_month(n1) and is_month(n2):
    print("AMBIGUOUS")
elif is_month(n1):
    print("MMYY")
elif is_month(n2):
    print("YYMM")
else:
    print("NA")

Solution (Python):
a = input()

if 0 < int(a[:2]) and int(a[:2]) <= 12:
    if 0 < int(a[2:]) and int(a[2:]) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")

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

Solution (Python):
def mm_check(s):
    if 1 <= int(s) <= 12:
        return True
    return False

def main():
    S = input().rstrip('\n')

    Spre = S[:2]
    Spost = S[2:]

    pre_check = mm_check(Spre)
    post_check = mm_check(Spost)

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

if __name__ == '__main__':
    main()

Solution (Python):
a = int(input())

L = int(a/100)
R = int(a%100)

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

Solution (Python):
S = input()
A = int(S[0:2])
B = int(S[2:4])

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

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

Solution (Python):
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')

Solution (Python):
n=input()
n1=n[:2]
n2=n[2:]
A=int(n1)
B=int(n2)
if 0<A<13:
    if 0<B<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<B<13:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()
first = int(S[0:2])
second = int(S[2:4])

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

Solution (Python):
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")

Solution (Python):
s = list(input())
if s[0] == "0":
    s[0] = ''
if s[2] == "0":
    s[2] = ''
x = int(s[0]+s[1])
y = int(s[2]+s[3])

if (x <= 12 and x >= 1) and (y >=1 and y <=12):
    print("AMBIGUOUS")

elif(x >= 0 and (y >= 1 and y <= 12)):
    print("YYMM")

elif(y >= 0 and (x >= 1 and x <= 12)):
    print("MMYY")

else:
    print("NA")