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

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

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

X, Y = int(S[0] + S[1]), int(S[2] + S[3])

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

Solution (Python):
s = input()

ym = False
my = False

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


if 0<=first<=99 and 1<=second<=12:
	ym = True
if 0<=second<=99 and 1<=first<=12:
	my = True

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

Solution (Python):
S = input()
A = int(S[:2])
B = int(S[2:])
flagAM = False
flagBM = False
if 1 <= A <= 12:
    flagAM = True

if 1 <= B <= 12:
    flagBM = True

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

Solution (Python):


S = input()
s1 = S[:2]
s2 = S[2:]
i1 = int(s1)
i2 = int(s2)

YYMM = False
MMYY = False

if 1 <= i1 <= 12:
    MMYY = True
if 1 <= i2 <= 12:
    YYMM = True

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

Solution (Python):
def is_month(n: int)->bool:
    return 1 <= n and n <= 12


def yymm_or_mmyy(S: str)->str:
    first = int(S[:2])
    second = int(S[2:])

    if is_month(first) and is_month(second):
        return "AMBIGUOUS"
    elif is_month(first):
        return "MMYY"
    elif is_month(second):
        return "YYMM"

    return "NA"


if __name__ == "__main__":
    S = input()

    ans = yymm_or_mmyy(S)
    print(ans)

Solution (Python):

import sys
from collections.abc import Iterable
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *
try:
    from math import gcd
except Exception:
    from fractions import gcd


def solve(S: str):
    ab = int(S[:2])
    db = int(S[2:])

    yymm = False
    if (0 <= ab <= 99) and (1 <= db <= 12):
        yymm = True
    mmyy = False
    if (0 <= db <= 99) and (1 <= ab <= 12):
        mmyy = True

    if yymm and mmyy:
        return 'AMBIGUOUS'
    if not (yymm or mmyy):
        return 'NA'

    if yymm:
        return 'YYMM'

    return 'MMYY'


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = (next(tokens))  
    result = solve(S)
    if isinstance(result, Iterable) and not isinstance(result, str):
        result = '\n'.join([str(v) for v in result])
    print(result)

if __name__ == '__main__':
    main()

Solution (Python):
S = input()

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

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

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

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

Solution (Python):
s=input()
mae=int(s[:2])
ato=int(s[2:])
if 1<=mae<=12:
    if 1<=ato<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=ato<=12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s = input()

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

yymm = 0 < second <= 12
mmyy = 0 < first <= 12

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

Solution (Python):
s = input()
flag1 = False
flag2 = False
if s[0:2] == "01" or s[0:2] == "02" or s[0:2] == "03" or s[0:2] == "04" or s[0:2] == "05" or s[0:2] == "06" or s[0:2] == "07" or s[0:2] == "08" or s[0:2] == "09" or s[0:2] == "10" or s[0:2] == "11" or s[0:2] == "12":
    flag1 = True
if s[2:4] == "01" or s[2:4] == "02" or s[2:4] == "03" or s[2:4] == "04" or s[2:4] == "05" or s[2:4] == "06" or s[2:4] == "07" or s[2:4] == "08" or s[2:4] == "09" or s[2:4] == "10" or s[2:4] == "11" or s[2:4] == "12":
    flag2 = True
if flag1 and flag2:
    print("AMBIGUOUS")
elif flag1 and (not flag2):
    print("MMYY")
elif (not flag1) and flag2:
    print("YYMM")
elif (not flag1) and (not flag2):
    print("NA")

Solution (Python):
s = input().strip()

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

Solution (Python):
s=input()
s1=s[:2]
s2=s[2:]
l=set(['01','02','03','04','05','06','07','08','09','10','11','12'])
if s1 not in l and s2 not in l:
    print('NA')
elif s1 in l and s2 not in l:
    print('MMYY')
elif s1 not in l and s2 in l:
    print('YYMM')
else:
    print('AMBIGUOUS')

Solution (Python):
def yymm(S):
    return 1 <= int(S[2:]) <= 12


def mmyy(S):
    return 1 <= int(S[:2]) <= 12


def main():
    S = input()
    y = yymm(S)
    m = mmyy(S)
    if y and m:
        print("AMBIGUOUS")
    elif y:
        print("YYMM")
    elif m:
        print("MMYY")
    else:
        print("NA")


if __name__ == "__main__":
    main()

Solution (Python):
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))

s = input()
a,b = s[:2], s[2:]
if 1 <= int(a) <= 12:
    if 1 <= int(b) <= 12:
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if 1 <= int(b) <= 12:
        ans =   "YYMM"
    else:
        ans = "NA"

print(ans)

Solution (Python):
s = input()

def ismonth(s):
	return int(s) in range(1, 13)

flag = 0
if ismonth(s[2:]):
	flag |= 1
if ismonth(s[:2]):
	flag |= 2
a = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(a[flag])

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

Solution (Python):
s = list(input())
bottom = int(s[2])*10 + int(s[3])
up = int(s[0])*10 + int(s[1])
if 1 <= bottom <= 12 and 1 <= up <= 12:
    print("AMBIGUOUS")
elif 1 <= bottom <= 12:
    print("YYMM")
elif 1 <= up <= 12:
    print("MMYY")
else:
    print("NA")

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

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

Solution (Python):

s = input()

res = []

if 0<int(s[2:])<13: 
    res.append("YYMM")
if 0<int(s[:2])<13: 
    res.append("MMYY")

if len(res)==1:
    print(res[0])
elif len(res)==2:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):


import math
import string


def check(s):
  n = int(s)
  if n>=1 and n<=12:
    return True
  else:
    return False


yymm = str(input())
ym1 = yymm[0:2]
ym2 = yymm[2:4]
if check(ym1) and check(ym2):
  print('AMBIGUOUS')
elif check(ym1) and not check(ym2):
  print('MMYY')
elif not check(ym1) and check(ym2):
  print('YYMM')
else:
  print('NA')

Solution (Python):

import sys
INF = float("inf")


def solve(S: str):
    mae = int(S[0:2])
    ushiro = int(S[2:])
    if 1 <= mae <= 12 and 1 <= ushiro <= 12:
        print("AMBIGUOUS")
    elif 1 <= mae <= 12:
        print("MMYY")
    elif 1 <= ushiro <= 12:
        print("YYMM")
    else:
        print("NA")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  
    solve(S)


if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()
mp_ok = int(s[0:2]) <= 12 and int(s[0:2]) > 0
mn_ok = int(s[2:]) <= 12 and int(s[2:]) > 0

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

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

leftM = left <= 12 and left >= 1
rightM = right <=12 and right >= 1

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

print(ans)

Solution (Python):
a=input()
b=int(a[0]+a[1])
c=int(a[2]+a[3])

if 0<b<13:
    if 0<c<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<c<13:
        print("YYMM")
    else:
        print("NA")

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

f = int(first)
s = int(second)



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

Solution (Python):




def main():
  s = input().strip()
  x = 1 <= int(s[:2]) <= 12
  y = 1 <= int(s[2:]) <= 12

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


if __name__ == '__main__':
  main()

Solution (Python):
def can_be_yymm(s):
    mm = int(s[2:])
    return 1 <= mm <= 12


def can_be_mmyy(s):
    mm = int(s[0:2])
    return 1 <= mm <= 12


def judge(s):
    yymm = can_be_yymm(s)
    mmyy = can_be_mmyy(s)
    if yymm and mmyy:
        return "AMBIGUOUS"
    elif yymm:
        return "YYMM"
    elif mmyy:
        return "MMYY"
    else:
        return "NA"


def main():
    s = input()
    print(judge(s))


if __name__ == "__main__":
    main()

Solution (Python):
def yymm(x):
    a = x[2]+x[3]
    return a in ['01','02','03','04','05','06','07','08','09','10','11','12']

def mmyy(x):
    a = x[0]+x[1]
    return a in ['01','02','03','04','05','06','07','08','09','10','11','12']

S = input()
if yymm(S) and mmyy(S):
    print("AMBIGUOUS")
elif not(yymm(S)) and mmyy(S):
    print("MMYY")
elif yymm(S) and not(mmyy(S)):
    print("YYMM")
else:
    print("NA")

Solution (Python):
S = input()

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

flag_a = False
flag_b = 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")

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    s = S()
    a = int(s[:2])
    b = int(s[2:])
    af = 1
    if a < 1 or a > 12:
        if b < 1 or b > 12:
            return 'NA'
        return 'YYMM'
    if b < 1 or b > 12:
        return 'MMYY'

    return 'AMBIGUOUS'


print(main())

Solution (Python):
s = input()

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

Solution (Python):
s = int(input())
if 1 <= s // 100 <= 12:
    if 1 <= s % 100 <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= s % 100 <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):


from collections import deque
import itertools as ite
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

S = raw_input()
n1 = int(S[:2])
n2 = int(S[2:])
flag1 = (1 <= n1 <= 12)
flag2 = (1 <= n2 <= 12)
if flag1 and flag2:
    print "AMBIGUOUS"
elif flag1 and not flag2:
    print "MMYY"
elif not flag1 and flag2:
    print "YYMM"
else:
    print "NA"

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

Solution (Python):
month = lambda x: 1 <= x <= 12

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

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

Solution (Python):
s = input()
x, y = int(s[:2]), int(s[2:])
a = 1 <= x <= 12
b = 1 <= y <= 12
if a ^ b:
    print("MMYY" if a else "YYMM")
else:
    print("AMBIGUOUS" if a else "NA")

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

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

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


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

Solution (Python):

def read_input():
    s = input()
    former = s[:2]
    latter = s[2:]
    return int(former), int(latter)


def can_month(x):
    return 1 <= x <= 12


def submit():
    f, l = read_input()

    if can_month(f) and can_month(l):
        print('AMBIGUOUS')
        return

    if can_month(f):
        print('MMYY')
        return

    if can_month(l):
        print('YYMM')
        return

    print('NA')

if __name__ == '__main__':
    submit()

Solution (Python):
S = input()

mae = int(S[0:2])
ushiro = int(S[2:])

if mae < 13 and mae > 0:

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

Solution (Python):



S = str(input())
L = len(S)



YYMM = 0 < int(S[2:]) <= 12


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

Solution (Python):
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 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 II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    S = SI()
    a = int(S[:2])
    b = int(S[2:])
    if 1 <= a <= 12 and 1 <= b <= 12:
        ans = 'AMBIGUOUS'
    elif 1 <= a <= 12:
        ans = 'MMYY'
    elif 1 <= b <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'
    return ans

print(main())

Solution (Python):



import sys  
import os
import time
import re
from pydoc import help
import string
import math
from operator import itemgetter
from collections import Counter
from collections import deque
from collections import defaultdict as dd
import fractions
from heapq import heappop, heappush, heapify
import array
from bisect import bisect_left, bisect_right, insort_left, insort_right
from copy import deepcopy as dcopy
import itertools



sys.setrecursionlimit(10**7)
INF = 10**20
GOSA = 1.0 / 10**10
MOD = 10**9+7
ALPHABETS = [chr(i) for i in range(ord('a'), ord('z')+1)]  
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 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 I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def DP(N, M, first): return [[first] * M for n in range(N)]
def DP3(N, M, L, first): return [[[first] * L for n in range(M)] for _ in range(N)]
from inspect import currentframe


def local_input():
    from pcm.utils import set_stdin
    import sys
    from pathlib import Path
    parentdir = Path(os.path.dirname(__file__)).parent
    inputfile = parentdir.joinpath('test/sample-1.in')
    if len(sys.argv) == 1:
        set_stdin(inputfile)


def solve():
    s = input()
    a = int(s[0:2])
    b = int(s[2:4])
    dump(a,b)

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

    return 0

if __name__ == "__main__":
    try:
        local_input()
        def dump(*args):
            names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}
            print(', '.join(names.get(id(arg),'???')+' => '+repr(arg) for arg in args), file=sys.stderr)
    except:
        def dump(*args):
            pass

    solve()

Solution (Python):


from math import *




s=input()

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

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

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

Solution (Python):
S = input().strip()
a, b = int(S[:2]), int(S[2:])
if 1 <= a <= 12:
    if 1 <= b <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1 <= b <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())


s = raw_input()
x = int(s[0] + s[1])
y = int(s[2] + s[3]) 
if x >= 1 and x <= 12:
	if y >= 1 and y <= 12:
		print 'AMBIGUOUS'
	else:
		print 'MMYY'
else:
	if y >= 1 and y <= 12:
		print 'YYMM'
	else:
		print 'NA'

Solution (Python):


def main():
    S = input()

    n1, n2 = int(S[:2]), int(S[-2:])

    mmyy = 1 <= n1 <= 12
    yymm = 1 <= n2 <= 12

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



if __name__ == '__main__':
    main()

Solution (Python):
import sys

inf = 10 ** 18

S = input()

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

flag = 0b00
if 1 <= aa <= 12:
    flag += 0b01
if 1 <= bb <= 12:
    flag += 0b10

if flag == 0b00:
    print('NA')
elif flag == 0b01:
    print('MMYY')
elif flag == 0b10:
    print('YYMM')
else:
    print('AMBIGUOUS')

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

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

ma = 1 <= a <= 12
mb = 1 <= b <= 12

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

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

Solution (Python):


def is_YY(s):
    if int(s) >= 0 and int(s) <= 99:
        return True
    return False

def is_MM(s):
    if int(s) >= 1 and int(s) <= 12:
        return True
    return False

def solve():
    S = input()
    upper = S[0:2]
    lower = S[2:]
    if is_YY(upper) and is_MM(lower):
        if is_YY(lower) and is_MM(upper):
            print("AMBIGUOUS")
            return
        print("YYMM")
    elif is_YY(lower) and is_MM(upper):
        print("MMYY")
    else:
        print("NA")


if __name__ == "__main__":
    solve()

Solution (Python):
s = input()

mmyy = 1 <= int(s[:2]) <= 12
yymm = 1 <= int(s[2:]) <= 12

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

Solution (Python):
a = input()

mm = a[:2]
yy = a[2:]

x = int(mm)
y = int(yy)

xm = False
ym = False

if x > 0 and x <= 12:
    xm = True
if y > 0 and y <= 12:
    ym = True

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

Solution (Python):
def solve(S):
    L = S[:2]
    R = S[2:]

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


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

Solution (Python):
S = input()
yymm = "01" <= S[2:4] <= "12"
mmyy = "01" <= S[0:2] <= "12"
if yymm and mmyy:
    print("AMBIGUOUS")
elif yymm:
    print("YYMM")
elif mmyy:
    print("MMYY")
else:
    print("NA")

Solution (Python):
S = raw_input()
YYMM = 1<=int(S[2:])<=12
MMYY = 1<=int(S[:2])<=12

if YYMM and not MMYY:
  print "YYMM"
if not YYMM and MMYY:
  print "MMYY"
if YYMM and MMYY:
  print "AMBIGUOUS"
if not YYMM and not MMYY:
  print "NA"

Solution (Python):
def can_be_month(n):
    return 1 <= n <= 12


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

if can_be_month(f):
    print('AMBIGUOUS' if can_be_month(l) else 'MMYY')
else:
    print('YYMM' if can_be_month(l) else 'NA')

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

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

Solution (Python):

import sys

def is_m(n):
    if n > 0 and n < 13:
        return True
    return False


def solve(S: str):
    a = int(S[:2])
    b = int(S[2:])
    if is_m(a) and not is_m(b):
        ret = 'MMYY'
    elif not is_m(a) and is_m(b):
        ret = 'YYMM'
    elif is_m(a) and is_m(b):
        ret = 'AMBIGUOUS'
    else:
        ret = 'NA'
    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = str(next(tokens))  
    solve(S)

if __name__ == '__main__':
    main()

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

Solution (Python):
a,b,c,d=input()
x,y=int(a+b),int(c+d)
if 0 < x < 13 and 0 < y < 13:
	print("AMBIGUOUS")
elif 0 < x < 13:
	print("MMYY")
elif 0 < y < 13:
	print("YYMM")
else:
	print("NA")

Solution (Python):
S=int(input())
m=S%100
n=S//100
if 0<m<=12:
    if 0<n<=12:
        print('AMBIGUOUS')
    else:
        print('YYMM')
else:
    if 0<n<=12:
        print('MMYY')
    else:
        print('NA')

Solution (Python):
s = list(map(int, list(input())))
one, two = False, False
if 0 < s[0]*10 + s[1] <= 12:
	one = True
if 0 < s[2]*10 + s[3] <= 12:
	two = True
if one and two:
	print("AMBIGUOUS")
elif one:
	print("MMYY")
elif two:
	print("YYMM")
else:
	print("NA")

Solution (Python):

S = input()

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

Solution (Python):
s = str(input())
mm = [i for i in range(1,13)]

if int(s[0]+s[1]) in mm:
    if int(s[2]+s[3]) in mm:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif int(s[2]+s[3]) in mm:
    print("YYMM")
else:
    print("NA")

Solution (Python):
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import sys

sys.setrecursionlimit(10000)
INF = float('inf')

S = input()

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

if S[:2] in m and S[2:] not in m:
    print('MMYY')
elif S[:2] not in m and S[2:] in m:
    print('YYMM')
elif S[:2] in m and S[2:] in m:
    print('AMBIGUOUS')
else:
    print('NA')

Solution (Python):


import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    s = input()
    y, m = int(s[:2]), int(s[2:])
    if 1 <= y <= 12 and 1 <= m <= 12:
        return "AMBIGUOUS"
    if 1 <= y <= 12:
        return "MMYY"
    if 1 <= m <= 12:
        return "YYMM"
    return "NA"


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

Solution (Python):

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

S = input()[:-1]
zenhan = S[:2]
kouhan = S[2:]

if 0 < int(zenhan) < 13:
    if 0 < int(kouhan) < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(kouhan) < 13:
        print("YYMM")
    else:
        print("NA")

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

Solution (Python):
import itertools
import math
from collections import defaultdict

def input_ints():
    return list(map(int, input().split()))

def solve():
    s = input()
    x = int(s[:2])
    y = int(s[2:])
    ans = 0
    if 1 <= x <= 12:
        ans |= 1
    if 1 <= y <= 12:
        ans |= 2
    print(['NA', 'MMYY', 'YYMM', 'AMBIGUOUS'][ans])

if __name__ == '__main__':
    solve()

Solution (Python):

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    s = input()
    front = int(s[0:2])
    back = int(s[2:4])
    if 0 < front < 13:  
        if 0 < back < 13: 
            print('AMBIGUOUS')
        else: 
            print('MMYY')
    else: 
        if 0 < back < 13: 
            print('YYMM')
        else: 
            print('NA')


if __name__ == '__main__':
    main()

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

hoge = (1 <= a <= 12)
fuga = (1 <= b <= 12)
if hoge and fuga:
    print("AMBIGUOUS")
elif not hoge and not fuga:
    print("NA")
elif fuga:
    print("YYMM")
else:
    print("MMYY")

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

Solution (Python):
s = input()

a = 0
if 1 <= int(s[0:2]) <= 12:
    a += 1
if 1 <= int(s[2:]) <= 12:
    a += 2

print(["NA", "MMYY", "YYMM", "AMBIGUOUS"][a])

Solution (Python):
import sys
sys.setrecursionlimit(20000000)

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

Solution (Python):



import array
from bisect import *
from collections import *
import fractions
import heapq
from itertools import *
import math
import random
import re
import string
import sys


def is_yymm(S):
    return 1 <= int(S[2:]) <= 12

def is_mmyy(S):
    return 1 <= int(S[:2]) <= 12

S = input()
if is_yymm(S):
    if is_mmyy(S):
        print('AMBIGUOUS')
    else:
        print('YYMM')
elif is_mmyy(S):
    if is_yymm(S):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    print('NA')

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

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

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

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

Solution (Python):
s = int(input())
a = s//100
b = s%100
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")