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

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

mm1 = first <= 12 and first > 0
mm2 = second <= 12 and second > 0

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

Solution (Python):
S = list(input())

aa = int(S[0]+S[1])
bb = int(S[2]+S[3])

yymm = 0;
mmyy = 0;

if(1<=aa and aa<=12):
    yymm = 1;

if(1<=bb and bb<=12):
    mmyy = 2;

if(yymm + mmyy == 3):
    print("AMBIGUOUS")
elif(yymm+mmyy == 2):
    print("YYMM")
elif(yymm+mmyy == 1):
    print("MMYY")
elif(yymm+mmyy == 0):
    print("NA")

Solution (Python):



def main():
    s = input()
    first = int(s[:2])
    last = int(s[2:])

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

if __name__ == '__main__':
    main()

Solution (Python):
read = input
s = read()
a, b = map(int , [s[:2], s[2:]])
YYMM = False
MMYY = False
if 1 <= b and b <= 12:
    YYMM = True
if 1 <= a and a <= 12:
    MMYY = True
if YYMM and MMYY :
    print('AMBIGUOUS')
elif YYMM and not MMYY:
    print('YYMM')
elif not YYMM and MMYY:
    print('MMYY')
else :
    print('NA')

Solution (Python):
import datetime
s = input()
try:
  a = datetime.datetime.strptime(s, '%y%m')
except ValueError:
  a = None
try:
  b = datetime.datetime.strptime(s, '%m%y')
except ValueError:
  b = None
if a==None and b==None:
  print("NA")
elif a!=None and b!=None:
  print("AMBIGUOUS")
elif a!=None:
  print("YYMM")
elif b!=None:
  print("MMYY")

Solution (Python):
S = input()

mae = int(S[:2])
ato = int(S[2:])

mae_f = 0

if mae >= 1 and mae <=12:
    mae_f = 1

ato_f = 0

if ato >= 1 and ato <=12:
    ato_f = 1
    
if mae_f == 0 and ato_f == 0:
    print('NA')
elif mae_f == 1 and ato_f == 1:
    print('AMBIGUOUS')
elif mae_f == 0:
    print('YYMM')
else:
    print('MMYY')

Solution (Python):
m = {0:"NA", 1:"YYMM", 2:"MMYY", 3:"AMBIGUOUS"}
s = input()
ans = 0
a = int(s[:2])
b = int(s[2:])
if 0 <= a <= 99 and 1 <= b <= 12:
    ans |= 1
if 0 <= b <= 99 and 1 <= a <= 12:
    ans |= 2
print(m[ans])

Solution (Python):

s = input()

head = int(s[:2])
tail = int(s[2:])

mmyy = 1 <= head <= 12
yymm = 1 <= tail <= 12

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

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

a = int(''.join(s[0:2]))
b = int(''.join(s[2:4]))

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

Solution (Python):
s = input()
d = s[:2]
y = s[2:]
if((int(d)>12 or int(d)==0) and (int(y)==0 or int(y)>12)):
    print('NA')
elif(0<int(d)<=12 and 0<int(y)<=12):
    print('AMBIGUOUS')
elif(0<int(d)<=12):
    print('MMYY')
elif(0<int(y)<=12):
    print('YYMM')

Solution (Python):
S = input()

if S == '0000':
    print('NA')
else:
    if '01' <= S[0:2] <= '12' and (S[2:4] >= '13' or S[2:4] == '00'):
        print('MMYY')
    elif '01' <= S[2:4] <= '12' and S[0:2] >= '13' or S[0:2] == '00':
        print('YYMM')
    elif '01' <= S[0:2] <= '12' and '01' <= S[2:4] <= '12':
        print('AMBIGUOUS')
    else:
        print('NA')

Solution (Python):

import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        S = int(input())
    else:
        pass

    AA = S // 100
    BB = S % 100

    if (0 < AA <= 12) & (0 < BB <= 12):
        print("AMBIGUOUS")
    elif(0 < AA <= 12):
        print("MMYY") 
    elif(0 < BB <= 12):
        print("YYMM")
    else:
        print("NA")

if __name__ =='__main__':
    main()

Solution (Python):
S=input()

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

Solution (Python):
import sys
import collections
from collections import Counter
from collections import deque
from collections import defaultdict
import itertools
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from itertools import takewhile
from itertools import compress
import functools
from functools import reduce
import math


from math import ceil
from math import floor



from math import factorial
import re
from functools import lru_cache













S = input()

a = S[0] + S[1]
b = S[2] + S[3]

a = int(a)
b = int(b)

isYYMM = False
isMMYY = False

if 1 <= b and b <= 12:
    isYYMM = True

if 1 <= a and a <= 12:
    isMMYY = True







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

print(ans)

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

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

Solution (Python):
S=int(input())
A=S//100
B=S%100


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

Solution (Python):
import sys

class SamInput(object):
    def __init__(self):
        self.inp = []
        for i in sys.stdin:
            i = i.replace("\n", "")
            j = list(i.split())
            self.inp.append(j)

    def readln(self):
        if len(self.inp) == 0:
            return False
        else:
            return str.join(" ", self.inp.pop(0))

    def read(self):
        if len(self.inp) == 0:
            return False
        while len(self.inp[0]) == 0:
            self.inp.pop(0)
            if len(self.inp) == 0:
                return False
        return self.inp[0].pop(0)

def main():
    inp = SamInput()
    x = inp.read()

    p1 = int(x[:2])
    p2 = int(x[2:])

    posdm = True
    posmd = True

    if p1 < 1 or p1 > 12:
        posmd = False

    if p2 < 1 or p2 > 12:
        posdm = False

    if posdm and posmd:
        print("AMBIGUOUS")
    elif (not posdm) and (not posmd):
        print("NA")
    elif posdm:
        print("YYMM")
    else:
        print("MMYY")


if __name__ == '__main__':
    main()

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

    former = S[:2]
    latter = S[2:]

    if mm_ok(former) and mm_ok(latter):
        print('AMBIGUOUS')
    elif mm_ok(former) and not mm_ok(latter):
        print('MMYY')
    elif mm_ok(latter) and not mm_ok(former):
        print('YYMM')
    else:
        print('NA')

def mm_ok(s):
    months = ['{:0>2}'.format(i+1) for i in range(12)]
    if s in months:
        return True
    else:
        return False


main()

Solution (Python):
S = input()

ml = [str(i).zfill(2) for i in range(1, 13)]

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

Solution (Python):
import sys
S = int(input())

mae = S//100
ushiro = S%100

if 0 < mae and mae <= 12:
    if 0 < ushiro and ushiro <= 12:
        print ('AMBIGUOUS')
        sys.exit()
    else:
        print ('MMYY')
        sys.exit()
if 0 < ushiro and ushiro <= 12:
    if 0 < mae and mae <= 12:
        print ('AMBIGUOUS')
        sys.exit()
    else:
        print ('YYMM')
        sys.exit()
print ('NA')

Solution (Python):
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint

import bisect
import copy
import fractions
import math
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    
    x = root(x)
    y = root(y)
    if x == y:
        return
    
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  
        return x
    else:
        node[x] = root(node[x])  
        return node[x]
def dfs(v):
    
    visited[v] = True
    for v2 in range(n):
        if graph[v][v2] == False:  
            continue
        if visited[v2] == True:  
            continue
        dfs(v2)

s = IS()
if 0 < int(s[0:2]) <= 12 and 0 < int(s[2:4]) <= 12:
    print('AMBIGUOUS')
elif 0 <= int(s[0:2]) <= 99 and 0 < int(s[2:4]) <= 12:
    print('YYMM')
elif 0 < int(s[0:2]) <= 12 and 0 <= int(s[2:4]) <= 99:
    print('MMYY')
else:
    print('NA')

Solution (Python):
s = input()

s_1 = int(s[:2])
s_2 = int(s[2:])

ans = ""

if (0<s_1<=12):
  if (0<s_2<=12):
    ans = "AMBIGUOUS"
  else:
    ans = "MMYY"
else:
  if (0<s_2<=12):
    ans = "YYMM"
  else:
    ans = "NA"
    
print(ans)

Solution (Python):
S = input()

m = int(S[:2])
u = int(S[2:])

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

Solution (Python):
def sub():
    S = input()
    head = int(S[:2])
    tail = int(S[2:])

    isHeadMM = False
    if head <=12 and head >0:
        isHeadMM = True

    isTailMM = False
    if tail <=12 and tail >0:
        isTailMM = True

    if isHeadMM is True and isTailMM is False:
        print("MMYY")
    elif isHeadMM is False and isTailMM is True:
        print("YYMM")
    elif isHeadMM is True and isTailMM is True:
        print("AMBIGUOUS")
    else:
        print("NA")

sub()

Solution (Python):
S = input()

str1 = int(S[0:2])
str2 = int(S[2:4])

MMYY = False
YYMM = False


if 1 <= str1 and str1 <= 12 and 0 <= str2 and str2 <= 99:
    MMYY = True

if 0 <= str1 and str1 <= 99 and 1 <= str2 and str2 <= 12:
    YYMM = True

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

Solution (Python):
s = input()

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

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

Solution (Python):
import itertools
import math

def judY(y):
    if  0<=y and y <= 99:
        return True
    else:
        return  False

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



s1 = input()
zenhan = int (s1[0:2])
kohan  = int(s1[2:])

zenhanY = False
zenhanM = False
kohanY = False
kohanM = False
if judY(zenhan):
    zenhanY = True

if judM(zenhan):
    zenhanM = True

if judM(kohan):
    kohanM = True

if judY(kohan):
    kohanY = True


YYMM = False
MMYY = False
if zenhanY and kohanM:
    YYMM = True

if zenhanM and kohanY:
    MMYY = True

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

Solution (Python):
S = input()
A = int(S[0]+S[1])
B = int(S[2]+S[3])
if (A > 0 and A < 13) and (B > 0 and B < 13):
    print('AMBIGUOUS ')
elif (A > 0 and A < 13) and (B > 12 or B == 0):
    print('MMYY')
elif (A > 12 or A == 0) and (B > 0 and B < 13):
    print('YYMM')
else:
    print('NA')

Solution (Python):
s=input()
first=int(s[0:2])
last=int(s[2:4])

if last>=1 and last<=12 and first>=1 and first<=12:
    print("AMBIGUOUS")

elif last>=1 and last<=12 :
    print("YYMM")
elif first>=1 and first<=12:
    print("MMYY")
else:
    print("NA")

Solution (Python):
S = input()
a = 0 < int(S[:2]) < 13
b = 0 < int(S[2:]) < 13

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

Solution (Python):
S = input()
up_y_flg = False
dw_y_flg = False
up_m_flg = False
dw_m_flg = False

if 1 <= int(S[0:2]) <= 12:
    up_m_flg = True
if 0 <= int(S[0:2]) <= 99:
    up_y_flg = True
if 1 <= int(S[2:4]) <= 12:
    dw_m_flg = True
if 0 <= int(S[2:4]) <= 99:
    dw_y_flg = True


if up_y_flg and dw_m_flg:
    if up_m_flg and dw_y_flg:
        print("AMBIGUOUS")
    else:
        print("YYMM")
elif up_m_flg and dw_y_flg:
    print("MMYY")
else:
    print("NA")

Solution (Python):
from sys import stdin


def valid_month(n):
    return 0 < n <= 12


def solve(s):
    fst, snd = int(s[:2]), int(s[2:])
    is_yymm = valid_month(snd)
    is_mmyy = valid_month(fst)
    if is_yymm and is_mmyy:
        return 'AMBIGUOUS'
    elif is_yymm or is_mmyy:
        return 'YYMM' if is_yymm else 'MMYY'
    else:
        return 'NA'


def main():
    s = stdin.readlines()[0].strip()
    ans = solve(s)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):

S = input()


temp1 = int(S[:2])
temp2 = int(S[2:])

flag1 = 0
flag2 = 0

if temp1 >= 13 or temp1 == 0:
    flag1 = 1
if temp2 >= 13 or temp2 == 0:
    flag2 = 1

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

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


if __name__ == "__main__":
    main()

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

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

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

Solution (Python):
S = input()
S1 = int(S[0] + S[1])
S2 = int(S[2] + S[3])

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

Solution (Python):
S=input()
first2 = int(S[0:2])
last2 = int(S[2:4])

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

Solution (Python):
def isMM(N0,N1):
  if N0*10 + N1>= 13:
    return False
  elif N0==0 and N1==0:
    return False
  else:
    return True
    
S = input()

N0 = int(S[0:1])
N1 = int(S[1:2])
N2 = int(S[2:3])
N3 = int(S[3:4])

D0 = isMM(N0,N1)
D1 = isMM(N2,N3)

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

Solution (Python):



S = input()

def is_yymm(str):
    _yy = int(str[0:2])
    mm = int(str[2:4])
    return (1 <= mm and mm <= 12)

def is_mmyy(str):
    mm = int(str[0:2])
    _yy = int(str[2:4])
    return (1 <= mm and mm <= 12)

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

Solution (Python):


import sys
input = sys.stdin.readline




S = input()

first_half = int(S[0 : 2])
second_half = int(S[2 : 4])

is_YYMM = False
is_MMYY = False

if 0 <= first_half and first_half <= 99 and 1 <= second_half and second_half <= 12 :
    is_YYMM = True
if 1 <= first_half and first_half <= 12 and 0 <= second_half and second_half <= 99 :
    is_MMYY = True

print("AMBIGUOUS" if is_YYMM and is_MMYY else "YYMM" if is_YYMM else "MMYY" if is_MMYY else "NA")

Solution (Python):
s = input()

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

def is_month(value):
    if value != 0 and value <= 12:
        return True
    else:
        return False

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

Solution (Python):
S = input()
S1 = int(S[:2])
S2 = int(S[2:])
if 0 < S1 and S1 < 13:
	if 0 < S2 and S2 < 13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 0 < S2 and S2 < 13:
		print("YYMM")
	else:
		print("NA")

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

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

Solution (Python):
S = input()
 
left = S[0:2]
right = S[2:4]
if left[0] == "0": left = left[1]
if right[0] == "0":right = right[1]
left, right = int(left), int(right)
 
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")

Solution (Python):
S = list(input())
A = 10 * int(S[0]) + int(S[1])
B = 10 * int(S[2]) + int(S[3])
if (A > 0) & (A < 13) & (B > 0) & (B < 13):
    print('AMBIGUOUS')
elif (A > 0) & (A < 13):
    print('MMYY')
elif (B > 0) & (B < 13):
    print('YYMM')
else:
    print('NA')

Solution (Python):
n = input()

firsttwo = int(n[0:2])
lasttwo = int(n[2:4])

if(firsttwo > 00 and firsttwo < 13):
  if(lasttwo > 00 and lasttwo < 13):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if(lasttwo > 00 and lasttwo < 13):
    print('YYMM')
  else:
    print('NA')

Solution (Python):
a = str(input())
a = list(a)

XX = int(a[0]+a[1])
YY = int(a[2]+a[3])

x=0
y=0
if(XX<=12 and XX!=0):
    x=1
if(YY<=12 and YY!=0):
    y=1

if(x+y==2):
    print("AMBIGUOUS")
elif(x==1):
    print("MMYY")
elif(y==1):
    print("YYMM")
else:
    print("NA")

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


pre = S // 100
lat = S % 100


is_pre_mmable = False
if 0 < pre and pre <= 12:
    is_pre_mmable = True

is_lat_mmable = False
if 0 < lat and lat <= 12:
    is_lat_mmable = True

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

Solution (Python):
S = input()
left = int(S[:2])
right = int(S[2:])
mm = 12
if left > mm and right <= mm and right != 0:
    print('YYMM')
elif left <= mm and right > mm and left != 0:
    print('MMYY')
elif left <= mm and right <= mm and left == 0 and right != 0:
    print('YYMM')
elif left <= mm and right <= mm and right == 0 and left != 0:
    print('MMYY')
elif left <= mm and right <= mm and left + right != 0:
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):

"""
AtCoder C
"""
 



 


 
def main():
    N = int(input())
    A= N//100
    B= N%100
    if (A==0 and B== 0) or (A==0 and B>12) or (A>12 and B==0)  or (A>12 and B>12):
        print("NA")
    elif ( A>12 or A==0) and(B<13):
        print("YYMM")
    elif(A<13) and(B>12 or B==0):
        print("MMYY")
    elif( A<13 and B<13):
        print("AMBIGUOUS")

if __name__ == "__main__":
    main()

Solution (Python):
S = list(input())

S_be = S[0] + S[1]
S_af = S[2] + S[3]

if 0 < int(S_be) and int(S_be) <= 12:
    if 0 < int(S_af) and int(S_af) <= 12:
        print("AMBIGUOUS")
    
    else:
        print("MMYY")

else:
    if 0 < int(S_af) and int(S_af) <= 12:
        print("YYMM")
    
    else:
        print("NA")

Solution (Python):
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

S = input()

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


am = ay = bm = by = False
if 1 <= a <= 12:
    am = True
if 1 <= b <= 12:
    bm = True
ay = True
by = True



if am and bm and ay and by:
    print('AMBIGUOUS')
elif am and by:
    print('MMYY')
elif bm and ay:
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
import sys
import datetime
def input(): return sys.stdin.readline().strip()

s  = lambda: input()

S = s()

a = S[:2]
b = S[2:]

yymm = True
mmyy = True
try:
  datetime.datetime.strptime(a+b, "%y%m")
except:
  yymm = False

try:
  datetime.datetime.strptime(b+a, "%y%m")
except:
  mmyy = False

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

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S=input()

A=int(S[:2])
B=int(S[2:])
mA=False
mB=False
if 1<=A<=12:
    mA=True
if 1<=B<=12:
    mB=True

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

Solution (Python):
S = list(input())

Sa = int(S[0]+S[1])
Sb = int(S[2]+S[3])

if 0<Sa<13:
    if 0<Sb<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0<Sb<13:
    print("YYMM")
else:
    print("NA")

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

Solution (Python):
s = int(input())
sd = s%100
su = s//100
if sd >= 13 or sd == 0 :
    if su >= 13 or su == 0:
        print("NA")
    else :
        print("MMYY")
else :
    if su >= 13 or su == 0 :
        print("YYMM")
    else :
        print("AMBIGUOUS")

Solution (Python):
s=input()
f=s[:2]
t=s[2:]
f=int(f)
t=int(t)
flagMM = 0
flagYY = 0
if 1<=f and f<=12:
    flagMM=1
if 1<=t and t<=12:
    flagYY=1
if flagMM and flagYY:
    print("AMBIGUOUS")
elif flagMM:
    print("MMYY")
elif flagYY:
    print("YYMM")
else:
     print("NA")

Solution (Python):
S = list(str(input()))

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

Solution (Python):
S = input()
A = S[:2]
A = int(A)
B = S[2:]
B = int(B)
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")

Solution (Python):
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):
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    S = input_raw[0]
    X = int(S[:2])
    Y = int(S[2:])
    if((1 <= X and  X <= 12) and (1 <= Y and  Y <= 12)):
        print "AMBIGUOUS"
    elif(1 <= X and  X <= 12) :
        print "MMYY"

    elif(1 <= Y and  Y <= 12):
        print "YYMM"
    else:
        print "NA"

if __name__ == '__main__':
    main()

Solution (Python):
strings = input()


def can_yymm(strings):
    mm = int(strings[2:])
    if mm >= 1 and mm <= 12:
        return True
    else:
        return False

def can_mmyy(strings):
    mm = int(strings[:2])
    if mm >= 1 and mm <= 12:
        return True
    else:
        return False

if can_yymm(strings) and not can_mmyy(strings):
    print('YYMM')
elif not can_yymm(strings) and can_mmyy(strings):
    print('MMYY')
elif can_yymm(strings) and can_mmyy(strings):
    print('AMBIGUOUS')
else:
    print('NA')

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

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

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

yymm = False
mmyy = False

if (int(tail)>0)&(int(tail)<=12):
    yymm = True

if (int(head)>0)&(int(head)<=12):
    mmyy = True
    
if (yymm == True)&(mmyy == True):
    print("AMBIGUOUS")
elif (yymm == True):
    print("YYMM")
elif (mmyy == True):
    print("MMYY")
else:
    print("NA")

Solution (Python):
S = input()

mae = S[0:2]
ush = S[2:4]

mon = {"01","02","03","04","05","06","07","08","09","10","11","12"}

if (mae in mon) and (ush in mon):
    print("AMBIGUOUS")
if (mae not in mon) and (ush in mon):
    print("YYMM")
if (mae in mon) and (ush not in mon):
    print("MMYY")
if (mae not in mon) and (ush not in mon):
    print("NA")

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

Solution (Python):
s = input()
first = int(s[:2])
second = int(s[2:])
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):
S = input()
flag_a = False
flag_b = False
if 0 < int(S[:2]) <= 12:
  flag_a = True
if 0 < int(S[2:]) <=12:
  flag_b = True
  
if flag_a and flag_b:
  print("AMBIGUOUS")
else:
  if flag_a:
    print("MMYY")
  elif flag_b:
    print("YYMM")
  else:
    print("NA")

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

Solution (Python):
S=raw_input()
YY=int( S[:2] )
MM=int( S[2:] )

if 1<=YY<=12 and 1<=MM<=12:
	print "AMBIGUOUS"
elif 0<=YY<=99 and 1<=MM<=12:
	print "YYMM"
elif 1<=YY<=12 and 0<=MM<=99:
	print "MMYY"
else:
	print "NA"

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

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

Solution (Python):
s = input().rstrip()
front = int(s[:2])
back = int(s[2:])

if (front >= 1 and front <= 12) and (back >= 1 and back <= 12):
    print("AMBIGUOUS")
elif (front >= 1 and front <= 12):
    print("MMYY")
elif (back >= 1 and back <= 12):
    print("YYMM")
else:
    print("NA")

Solution (Python):
S=input()

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

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 (first>12 or first==0) and second<=12:
    print('YYMM')
    
else:
    print('AMBIGUOUS')

Solution (Python):
S = list(input())

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

def main():
	if (A > 0 and A <= 12) and (B > 0 and B <= 12):
		print("AMBIGUOUS")
		return
	if B > 0 and B <= 12:
		print("YYMM")
		return
	if A > 0 and A <= 12:
		print("MMYY")
		return
	print("NA")
if __name__ == '__main__':
	main()

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

Solution (Python):

def input_from_console():
    s = input().rstrip()
    return s


def main():
    def check_mm(mm):
        if mm >= '01' and mm <= '12':
            return True
        return False
    s = input_from_console()
    e1 = check_mm(s[:2])
    e2 = check_mm(s[2:])
    if e1 == True and e2 == False:
        print('MMYY')
    elif e1 == False and e2 == True:
        print('YYMM')
    elif e1 == True and e2 == True:
        print('AMBIGUOUS')
    else:
        print('NA')


if __name__ == "__main__":
    main()

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


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