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):
a,b,c,d = list(input())

ab = int(a+b)
cd = int(c+d)

if ab >= 1 and ab <= 12 and cd >= 1 and cd <= 12:
  ans = 'AMBIGUOUS'
else:
  if  ab >= 1 and ab <= 12:
    ans = 'MMYY'
  elif cd >= 1 and cd <= 12:
    ans = 'YYMM'
  else:
    ans = 'NA'

print(ans)

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

Solution (Python):
s=int(input())
s1=s//100
s2=s%100
if 12>=s1>=1 and 12>=s2>=1:
    ans="AMBIGUOUS"
elif 12>=s1>=1 and not 12>=s2>=1:
    ans="MMYY"
elif 12>=s2>=1 and not 12>=s1>=1:
    ans="YYMM"
else:
    ans="NA"
print(ans)

Solution (Python):

def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)









s=input()

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

fa=False
fb=False
if 1 <= a <= 12:
    fa=True
if 1 <= b <= 12:
    fb=True
    
if fa:
    if fb:
        ans="AMBIGUOUS"
    else:
        ans="MMYY"
else:
    if fb:
        ans="YYMM"
    else:
        ans="NA"
    
print(ans)

Solution (Python):
S = input()
F = int(S[:2])
L = int(S[2:])

if (F >= 13 and L >= 13) or (F == 0 and L == 0) or (F >= 13 and L == 0) or (F == 0 and L >= 13):
    print('NA')
elif F >= 13 or F == 0:
    print('YYMM')
elif L >= 13 or L == 0:
    print('MMYY')
else:
    print('AMBIGUOUS')

Solution (Python):
s = input()

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

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

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

if a*b:
  if a<=12:
    if b<=12:
      print('AMBIGUOUS')
    else:
      print('MMYY')
  else:
    if b<=12:
      print('YYMM')
    else:
      print('NA')
else:
  if a:
    if a<=12:
      print('MMYY')
    else:
      print('NA')
  elif b:
    if b<=12:
      print('YYMM')
    else:
      print('NA')
  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 and not 1<=b<=12:
    print("MMYY")
elif 1<=b<=12 and not 1<=a<=12:
    print("YYMM")
else:
    print("NA")

Solution (Python):
n=input()
f=n[:2]
l=n[2:]
if (f=="00" and l=="00") or (int(f)>12 and int(l)>12) or (int(f)>12 and l=="00") or (int(l)>12 and f=="00") :
    print("NA")
elif int(f)>12 or f=="00":
    print("YYMM")
elif int(l)>12 or l=="00":
    print("MMYY")
else:
    print("AMBIGUOUS")

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

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

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

Solution (Python):
s=input()
cand=["0"+str(i) for i in range(1,10)]+["10","11","12"]
if s[:2] in cand and s[2:] in cand:
    print("AMBIGUOUS")
elif s[:2] in cand:
    print("MMYY")
elif s[2:] in cand:
    print("YYMM")
else:
    print("NA")

Solution (Python):
def main():
    s  = int(input())
    k = s//100
    t = s%100

    if(k>0 and k<13) and (t>0 and t<13):
        res = "AMBIGUOUS"
    elif(k>0 and k<13):
        res = "MMYY"
    elif(t>0 and t<13):
        res = "YYMM"
    else:
        res = "NA"
    print(res)






if __name__ == '__main__':
    main()

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

Solution (Python):
n = list(input())
a = n[0] + n[1]
b = n[2] + n[3]
num = ('01','02','03','04','05','06','07','08','09','10','11','12')
if a in num and b in num:
    print('AMBIGUOUS')
elif b in num:
    print('YYMM')
elif a in num:
    print('MMYY')
else:
    print('NA')

Solution (Python):

s = input()
sa = int(s[:2])
sb = int(s[2:])

if sa >= 1 and sa <= 12 and sb >= 1 and  sb <= 12:
    print('AMBIGUOUS')
    exit()
else:
    if sa >= 1 and sa <= 12:
        print('MMYY')
        exit()
    if sb >= 1 and sb <= 12:
        print('YYMM')
        exit()

print('NA')

Solution (Python):
def resolve():
    S = input()
    P = int(S[0]+S[1])
    Q = int(S[2]+S[3])
    if 0<P<=12 and 0<Q<=12:
        print("AMBIGUOUS")
    elif 0<P<=12 and (Q>12 or Q==0):
        print("MMYY")
    elif (P>=13 or P==0) and 0<Q<=12:
        print("YYMM")
    else:
        print("NA")
resolve()

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

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

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()

s = input()

left = s[:2]
right = s[2:]

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

Solution (Python):
import sys
input = lambda : sys.stdin.readline().rstrip()

s = input()

left = s[:2]
right = s[2:]

months = [str(x).zfill(2) for x in range(1, 13)]

ans = "AMBIGUOUS" if left in months and right in months else "YYMM" if right in months else "MMYY" if left in months else "NA"

print(ans)

Solution (Python):
S = input()

def M(x):
  if 1 <= int(x) <= 12:
    return 1
  else:
    return 0

L = M(S[:2])
R = M(S[2:])

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

Solution (Python):
s = input()
s1 = int(s[0])
s2 = int(s[1])
s3 = int(s[2])
s4 = int(s[3])
if(0 < (10 * s1 + s2) < 13 and 0 < (10 * s3 + s4) < 13):
  print('AMBIGUOUS')
elif(0 < (10 * s3 + s4) < 13):
  print('YYMM')
elif(0 < (10 * s1 + s2) < 13):
  print('MMYY')
else:
  print('NA')

Solution (Python):
def check(num):
    return (1<=int(num) and int(num)<=12)
s=input()
first=check(int(s[0:2]))
second=check(int(s[2:]))
if first and second:
    print("AMBIGUOUS")
elif first and not second:
    print("MMYY")
elif not first and second:
    print("YYMM")
else:
    print("NA")

Solution (Python):
def main():
    s = list(input())
    s12 = int(s[0]) * 10 + int(s[1]) * 1
    s34 = int(s[2]) * 10 + int(s[3]) * 1
    l = list()
    for i in [s12, s34]:
        if i >= 1 and i <= 12:
            l.append(True)
        else:
            l.append(False)
    if l[0] == False and l[1] == False:
        print('NA')
    elif l[0] == False and l[1] == True:
        print('YYMM')
    elif l[0] == True and l[1] == False:
        print('MMYY')
    else:
        print('AMBIGUOUS')

if __name__ == '__main__':
    main()

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

    front = int(''.join(S[:2]))
    back = int(''.join(S[2:]))

    if (1 <= front <= 12 and 1 <= back <= 12):
        print('AMBIGUOUS')
        return

    if (1 <= back <= 12):
        print('YYMM')
        return

    if (1 <= front <= 12):
        print('MMYY')
        return

    print('NA')


resolve()

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

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

print(ans)

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

Solution (Python):
s = input()

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

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

Solution (Python):
s = input()
a, b = int(s[:2]), 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()



mae = int(s[:2])
usi = int(s[2:])



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

Solution (Python):

s = int(input())

left = int(s/100)
right = int(s%100)


if left > 12 or left <= 0:
    if right > 12 or right <= 0:
        print('NA')
    else:
        print('YYMM')
else:
    if right > 12 or right <= 0:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Solution (Python):


s = str(input())

a = s[0:2]

b = s[2:]


def div(a):
    a = int(a)
    if a <= 12 and a >= 1:
        return "BOTH"
    else:
        return "YY"


if div(a) == div(b):
    if div(a) == "YY":
        print("NA")
    else:
        print("AMBIGUOUS")
elif div(a) == "YY":
    print("YYMM")
else:
    print("MMYY")

Solution (Python):
s = int(input())
L, R = divmod(s, 100)
if 0 < L < 13:
    if 0 < R < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 0 < R < 13:
    print('YYMM')
else:
    print('NA')

Solution (Python):
def is_yymm(fmt):
    _, month = fmt[:2], fmt[2:]
    if 1 <= int(month) <= 12:
        return True
    else:
        return False


def is_mmyy(fmt):
    month, _ = fmt[:2], fmt[2:]
    if 1 <= int(month) <= 12:
        return True
    else:
        return False


s = input()
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):
import numpy as np
S = input()
mcount = np.zeros(2)
s1 = int(S[0])
s2 = int(S[1]) 
s3 = int(S[2]) 
s4 = int(S[3])
s5 = s1 * 10 + s2
s6 = s3 * 10 + s4
if s5 == 0 or s5 >= 13:
  mcount[0] = 1
if s6 == 0 or s6 >= 13:
  mcount[1] = 1
if mcount[0] == 0 and mcount[1] == 0:
  print("AMBIGUOUS")
elif mcount[0] == 1 and mcount[1] == 0:
  print("YYMM")
elif mcount[0] == 0 and mcount[1] == 1:
  print("MMYY")
else:
  print("NA")

Solution (Python):
import sys

S =int(input())
a = S//100
b = S%100
if 1 <= a <= 12 and 1 <= b <= 12 :
    print("AMBIGUOUS")
    sys.exit()

elif 1 <= a <= 12 :
    print("MMYY")
    sys.exit()

elif 1 <= b <= 12 :
    print("YYMM")
    sys.exit()
else : print("NA")

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

ym = False
my = False
if a >= 0 and b>0 and b <= 12:
  ym = True
if b >= 0 and a>0 and a <= 12:
  my = True

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

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

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

if "".join(S[0:2]) in M and not("".join(S[2:]) in M):
    print("MMYY")
elif not("".join(S[0:2]) in M) and "".join(S[2:]) in M:
    print("YYMM")
elif "".join(S[0:2]) in M and "".join(S[2:]) in M:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):
n = int(input())
n1 = n//100
n2 = n%100
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()
left = int(S[:2])
right = int(S[2:])

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):
from sys import stdin
def S(): return stdin.readline().rstrip()

s = S()

ym = True
my = True

tmp = ''
for i in range(2):
    tmp += s[i]
tmp = int(tmp)
if tmp < 1 or 12 < tmp:
    my = False

tmp = ''
for i in range(2):
    tmp += s[i+2]
tmp = int(tmp)
if tmp < 1 or 12 < tmp:
    ym = False

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

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

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

Solution (Python):
S = input()
first = int(S[:2])
last = int(S[2:])

is_month_first = False
is_month_last = False

if first <= 12 and first > 0:
    is_month_first = True
if last <= 12 and last > 0:
    is_month_last = True

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

Solution (Python):
s = input()

fore = int(str(s[0]) + str(s[1]))
aft = int(str(s[2]) + str(s[3]))

if 1 <= fore <= 12:
    if 1 <= aft <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')

elif 1 <= aft <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()

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

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

if 1 <= S1 and S1 <= 12:
    if 1 <= S2 and S2 <=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
    
elif 1 <= S2 and S2 <= 12:
    print("YYMM")

else:
    print("NA")

Solution (Python):



def main():
    s = input()
    s1 = s[:2]
    s2 = s[2:]
    if 1 <= int(s1) <= 12:
        if 1 <= int(s2) <= 12:
            print('AMBIGUOUS')
        else:
            print('MMYY')
    else:
        if 1 <= int(s2) <= 12:
            print('YYMM')
        else:
            print('NA')


if __name__ == '__main__':
    main()

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()

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

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

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

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

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

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

Solution (Python):
def check_month(n):
  return 1 <= n <= 12
def check_year(n):
  return 0 <= n <= 99

S = input()
Y = int(S[:2])
M = int(S[2:])
if check_month(Y) and check_month(M):
  print('AMBIGUOUS')
elif check_month(Y) and check_year(M):
  print('MMYY')
elif check_year(Y) and check_month(M):
  print('YYMM')
else:
  print('NA')

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

Solution (Python):


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


S = input()


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



if __name__ == "__main__":
    main()

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('YYMM')
elif 1 <= int(s[:2]) <= 12:
  print('MMYY')
else:
  print('NA')

Solution (Python):
s = str(input())
top = int(s[:2])
bottom = int(s[2:])

if 1 <= top <= 12 and 1 <= bottom <= 12:
    print('AMBIGUOUS')
elif top > 12 and bottom > 12:
    print('NA')
elif 1 <= top <= 12:
    print('MMYY')
elif 1 <= bottom <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = str(input())
top = int(s[:2])
bottom = int(s[2:])

if 1 <= top <= 12 and 1 <= bottom <= 12:
    print('AMBIGUOUS')
elif top > 12 and bottom > 12:
    print('NA')
elif 1 <= top <= 12:
    print('MMYY')
elif 1 <= bottom <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):

S = input()
x, y = S[:2], S[2:]


not_MM_x = (int(x) >= 13)
not_MM_y = (int(y) >= 13)
zero_x = (x == "00")
zero_y = (y == "00")
checker = [not_MM_x, not_MM_y, zero_x, zero_y]

if checker in [[True, False, False, False], [False, False, True, False]]:
    print("YYMM")
elif checker in [[False, True, False, False], [False, False, False, True]]:
    print("MMYY")
elif checker == [False, False, False, False]:
    print("AMBIGUOUS")
else:
    print("NA")

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

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

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

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

Solution (Python):
S = list(input())
f1 = 1
f2 = 1
A = int(''.join(S[:2]))
B = int(''.join(S[2:]))
if A >= 13 or A == 0:
    f1 = 0
if B >= 13 or B == 0:
    f2 = 0
if f1 == 1 and f2 == 1:
    print('AMBIGUOUS')
elif f1 == 1 and f2 == 0:
    print('MMYY')
elif f1 == 0 and f2 == 1:
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
import numpy as np
INF = float("inf")











S = list(input())[:-1]
a = 10*int(S[0])+int(S[1])
b = 10*int(S[2])+int(S[3])
if (a > 12 or a == 0) and (b > 12 or b == 0):
    print("NA")
elif a > 12 or a == 0:
    print("YYMM")
elif b > 12 or b == 0:
    print("MMYY")
else:
    print("AMBIGUOUS")

Solution (Python):
ym = int(input())
 
ym1 = int(ym/100)
ym2 = int(ym%100)
 
if ym1 >= 1 and ym1 <= 12 and ym2 >= 1 and ym2 <=12:
  print('AMBIGUOUS')
elif ym2>=1 and ym2<=12:
  print('YYMM')
elif ym1>=1 and ym1<=12:
  print('MMYY')
else:
  print('NA')

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

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

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

for i in range(4):
    s[i] = int(s[i])

a = s[0]*10 + s[1]
b = s[2]*10 + s[3]


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

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

Solution (Python):
import sys
input = sys.stdin.readline
def main():
    S = list(input().rstrip())
    f = int("".join(S[0:2]))
    b = int("".join(S[2:4]))
    if 0<f<13 and 0<b<13:
        print("AMBIGUOUS")
    elif 0<f<13:
        print("MMYY")
    elif 0<b<13:
        print("YYMM")
    else:
        print('NA')

if __name__ == '__main__':
    main()

Solution (Python):
S = input()
s = list(S)
p = -1
q = -1
a = [s[0],s[1]]
b = [s[2],s[3]]
if 1 <= int(''.join(a)) <= 12:
    p = 1
else:
    p = 0
if 1 <= int(''.join(b)) <= 12:
    q = 1
else:
    q = 0
if p == 1 and q == 1:
    print('AMBIGUOUS')
elif p == 0 and q == 1:
    print('YYMM')
elif p == 1 and q == 0:
    print('MMYY')
else:
    print('NA')

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

Solution (Python):

import sys


def solve(S: str):
    d1 = int(S[:2])
    d2 = int(S[2:])
    print({
        (False, False): "NA",
        (False, True): "YYMM",
        (True, False): "MMYY",
        (True, True): "AMBIGUOUS",
    }[1 <= d1 <= 12, 1 <= d2 <= 12])


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


if __name__ == '__main__':
    main()

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

else:
    if int(s[2])*10 + int(s[3]) > 12 or int(s[2]) + int(s[3]) == 0:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Solution (Python):
S = input()

YY = ["{:02d}".format(i) for i in range(100)]
MM = ["{:02d}".format(i) for i in range(1, 13)]

flag = [False, False]
result = ""


if S[0:2] in YY and S[2:4] in MM:
    flag[0] = True

if S[2:4] in YY and S[0:2] in MM:
    flag[1] = True

if flag[0] and flag[1]:
    print("AMBIGUOUS")
elif flag[0]:
    print("YYMM")
elif flag[1]:
    print("MMYY")
else:
    print("NA")

Solution (Python):
S=input()

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

Solution (Python):
import sys

input = sys.stdin.readline


def main():
  S = input().strip()
  s, t = int(S[:2]), int(S[2:])
  
  s_mm = (1 <= s <= 12)
  t_mm = (1 <= t <= 12)
  
  mapping = {
    (True, True): 'AMBIGUOUS',
    (True, False): 'MMYY',
    (False, True): 'YYMM',
    (False, False): 'NA'
  }
  
  print(mapping[(s_mm, t_mm)])



if __name__ == '__main__':
  main()

Solution (Python):
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)




input_list = lambda : list(map(int,input().split()))

s=input()
p_a=int(s[:2])
p_b=int(s[2:])
yymm=(0<p_b<13)
mmyy=(0<p_a<13)


if yymm and mmyy:
    print("AMBIGUOUS")
    exit()

if yymm:
    print("YYMM")
    exit()
if mmyy:
    print("MMYY")
    exit()

print("NA")

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

front = s//100
back = s%100

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

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

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

Solution (Python):

import sys
input = sys.stdin.readline
S =input().strip()

s12 =int(S[:2])
s34 =int(S[2:])
mm=[1,2,3,4,5,6,7,8,9,10,11,12]
yy=[i for i in range(100)]
if s12 in yy and s12 in mm and s34 in yy and s34 in mm:
    print("AMBIGUOUS")
elif s12 in yy and s34 in mm:
    print("YYMM")
elif s12 in mm and s34 in yy :
    print("MMYY")
else:
    print("NA")

Solution (Python):
s=list(input())
a=int(s[0])*10+int(s[1])
b=int(s[2])*10+int(s[3])
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):
S = input()
s0 = 0 < int(S[:2]) <= 12
s1 = 0 < int(S[2:]) <= 12
if s0 and s1:
    print('AMBIGUOUS')
elif s0 and not s1:
    print('MMYY')
elif not s0 and s1:
    print('YYMM')
else:
    print('NA')

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

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

Solution (Python):
NUM = input()
Y1, M1 = int(NUM[:2]), int(NUM[2:])
Y2, M2 = M1, Y1

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

Solution (Python):
import itertools
import math
import fractions
import functools
import copy
s = input()

front = int(s[0]+s[1])
back = int(s[2]+s[3])

if (1 <= front and front <= 12) and (1 <= back and back <= 12):
    print("AMBIGUOUS")
    quit()
if (1 <= front and front <= 12):
    print("MMYY")
    quit()
if (1 <= back and back <= 12):
    print("YYMM")
    quit()

print("NA")

Solution (Python):
s=input()
YY=["00"]
MM=["01","02","03","04","05","06","07","08","09","10","11","12"]

for i in range(13,100):
    YY.append(str(i))

if s[:2] in YY and s[2:] in MM:
    print("YYMM")
elif s[:2] in MM and s[2:] in YY:
    print("MMYY")
elif s[:2] in MM and s[2:] in MM:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):
import sys

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

S = S()

first = S[:2]
second = S[2:4]

if 0 < int(first) <= 12:
    if 0 < int(second) <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0 < int(second) <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()

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

if 1 <= s1 <= 12 :
    if 1<= s2 <= 12:
        print("AMBIGUOUS")
    else :
        print("MMYY")
elif 1 <= 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 and (b>=13 or b==0):
    print("MMYY")
elif a>=13 and (b>=13 or b==0):
    print("NA")
elif a>=13 and 1<=b<=12:
    print("YYMM")
elif a==0 and (b>=13 or b==0):
    print("NA")
elif a==0 and (1<=b<=12):
    print("YYMM")

Solution (Python):
S = input()

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

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

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