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=s[0]+s[1]
s2=s[2]+s[3]

if (s1[0]=='0' and s1!='00') or s1=='11' or s1=='12':
  ans1='MM'
else:
  ans1='YY'

if (s2[0]=='0' and s2!='00') or s2=='11' or s2=='12':
  ans2='MM'
else:
  ans2='YY'

if ans1==ans2=='MM':
  print('AMBIGUOUS')
elif ans1==ans2=='YY':
  print('NA')
else:
  print(ans1+ans2)

Solution (Python):
s = input()

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

print(ans)

Solution (Python):
S = input()
is_YYMM = True
is_MMYY = True
if int(S[0] + S[1]) > 12 or int(S[0] + S[1]) == 0:
    is_MMYY = False
if int(S[2] + S[3]) > 12 or int(S[2] + S[3]) == 0:
    is_YYMM = False

if is_MMYY and is_YYMM:
    print('AMBIGUOUS')
elif is_YYMM:
    print('YYMM')
elif is_MMYY:
    print('MMYY')
else:
    print('NA')

Solution (Python):
S = input()
a, b = S[0:2], S[-2:]

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

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

A = S[0] + S[1]
B = S[2] + S[3]

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

Solution (Python):
s = input()

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

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

Solution (Python):


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

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

x = int(s[0] + s[1])
y = int(s[2] + s[3])

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

Solution (Python):
s = input()
YYMM = False
MMYY = False

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

Solution (Python):
s = input()

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

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

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

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

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

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

Solution (Python):
import math
import itertools
import statistics

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




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

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

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

else:
    print("NA")

Solution (Python):
S=input()

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

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

if "00" < s1 < "13" and "00" < s2 < "13" :
    print("AMBIGUOUS")
elif "00" < s2 < "13" :
    print("YYMM")
elif "00" < s1 < "13" :
    print("MMYY")
else :
    print("NA")

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

mae = a*10 + b 
ushiro = c*10 + d
if mae <= 12 and mae != 0:
    if ushiro <= 12 and ushiro != 0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if ushiro <= 12 and ushiro != 0:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()

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

Solution (Python):
s = input()
ans = "NA"
c = 0

if 0<=int(s[:2])<=99 and 1<=int(s[2:])<=12:
  ans = "YYMM"
  c += 1

if 1<=int(s[:2])<=12 and 0<=int(s[2:])<=99:
  ans = "MMYY"
  c+=1
if c == 2:
  ans = "AMBIGUOUS"
print(ans)

Solution (Python):

import sys

def isMonth(s):
    if s[0] == "0":
        return s[1] != "0"
    elif s[0] == "1":
        return s[1] == "0" or s[1] == "1" or s[1] == "2"
    return False
        

def solve(S: str):
    first = isMonth(S[:2])
    last = isMonth(S[2:])
    if not first and not last:
        print("NA")
    elif first and last:
        print("AMBIGUOUS")
    elif first and not last:
        print("MMYY")
    else:
        print("YYMM")
    return



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):
a=input()
a_i=int(a[0:2])
b_i=int(a[2:4])
if 0<a_i<=12 and 0<b_i<=12:
    print('AMBIGUOUS')
elif 0<b_i<=12:
    print("YYMM")
elif 0<a_i<=12:
    print("MMYY")
else:
    print("NA")

Solution (Python):
import datetime


def is_YYMM(s: str) -> bool:
    try:
        datetime.datetime.strptime(s, "%y%m")
    except ValueError:
        return False
    else:
        return True


def is_MMYY(s: str) -> bool:
    try:
        datetime.datetime.strptime(s, "%m%y")
    except ValueError:
        return False
    else:
        return True


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):
s=input()
up=s[0:2]
bot=s[2:4]
bot_m=True
up_m=True
if bot == "00" or int(bot) > 12:
        bot_m=False
if up == "00" or int(up) > 12:
        up_m=False
if bot_m and up_m:
        print("AMBIGUOUS")
elif bot_m and not up_m:
        print("YYMM")
elif not bot_m and up_m:
        print("MMYY")
else:
        print("NA")

Solution (Python):
s = input()
fir = int(s[:2])
sec = int(s[2:])

if fir == 0:
    if sec == 0:
        print('NA')
    elif 0 < sec <= 12:
        print('YYMM')
    else:
        print('NA')
elif 0 < fir <= 12:
    if sec == 0:
        print('MMYY')
    elif 0 < sec <= 12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if sec == 0:
        print('NA')
    elif 0 < sec <= 12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):

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

Solution (Python):
s = input()

a = s[:2]
b = s[-2:]

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

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

Solution (Python):
s = input()
yymm = False
mmyy = False
first = int(s[:2])
last = int(s[2:])
if first<=12 and first >0:
    mmyy = True
if last <=12 and last>0:
    yymm = True
if mmyy == True and yymm == True:
    print('AMBIGUOUS')
elif mmyy == True and yymm == False:
    print('MMYY')
elif mmyy == False and yymm == True:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S = input()

may_YYMM = False
may_MMYY = False
months = ["{:02}".format(i) for i in range(1, 12+1)]

if S[:2] in months:
    may_MMYY = True
if S[2:] in months:
    may_YYMM = True

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

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

Solution (Python):
str = input()
mae = str[0:2]
ato = str[2:4]

month = ["01","02","03","04","05","06","07","08","09","10","11","12"]
if mae in month:
  if ato in month:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if ato in month:
    print("YYMM")
  else:
    print("NA")

Solution (Python):
S = input()
a = int(S[0:2])
b = int(S[2:4])
if 1<=a<=12:
    if 1<=b<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1<=b<=12:
    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()
if (int(s[:2]) >= 13 or s[:2] == '00') and (int(s[2:4]) >= 13 or s[2:4] == '00'):
    print('NA')
elif 0 < int(s[:2]) <= 12 and 0 < int(s[2:4]) <= 12:
    print('AMBIGUOUS')
elif 0 < int(s[:2]) <= 12:
    print('MMYY')
else:
    print('YYMM')

Solution (Python):

n=int(input())
n_1=n//100
n_2=n%100

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

Solution (Python):



def main():
  s = input().strip()
  yy, mm = map(int, [s[:2], s[2:]])
  if 1 <= yy <= 12 and 1 <= mm <= 12:
    print('AMBIGUOUS')
  if not (1 <= yy <= 12) and 1 <= mm <= 12:
    print('YYMM')
  if 1 <= yy <= 12 and not (1 <= mm <= 12):
    print('MMYY')
  if not(1 <= yy <= 12) and not (1 <= mm <= 12):
    print('NA')

if __name__=='__main__':
  main()

Solution (Python):
import math
import string


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


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


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

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

f, r = map(int, (S[:2], S[2:]))
ans = ''
if 1 <= f <= 12 and 1 <= r <= 12:
  ans = 'AMBIGUOUS'
elif 1 <= f <= 12:
  ans = 'MMYY'
elif 1 <= r <= 12:
  ans = 'YYMM'
else:
  ans = 'NA'

print(ans)

Solution (Python):
S=input()
A=int(S[0:2])
B=int(S[2:4])
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=list(input())
def main():
    while True:
        if 1<=int(S[0]+S[1])<=12:
            if 1<=int(S[2]+S[3])<=12:
                return 'AMBIGUOUS'
            else:
                return 'MMYY'
        else:
            if 1<=int(S[2]+S[3])<=12:
                return 'YYMM'
            else:
                return 'NA'

print(main())

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

    l = int(S[:2])
    r = int(S[2:])

    if (l > 12 or l == 0) and (r > 12 or r == 0):
        print("NA")
        exit()

    if l > 12 or l == 0:
        print("YYMM")
        exit()

    if r > 12 or r == 0:
        print("MMYY")
        exit()

    print("AMBIGUOUS")


main()

Solution (Python):
s = input()
firstHalf = s[:2]
secondHalf = s[2:]
val1 = 0
val2 = 0
if firstHalf[0] == '0':
    val1 = int(firstHalf[1])
else:
    val1 = int(firstHalf)
if secondHalf[0] == '0':
    val2 = int(secondHalf[1])
else:
    val2 = int(secondHalf)
first = False
second = False
if val1 <= 12 and val1 > 0:
    first = True
if val2 <= 12 and val2 > 0:
    second = True
if first and second:
    print("AMBIGUOUS")
elif first:
    print("MMYY")
elif second:
    print("YYMM")
else:
    print("NA")

Solution (Python):
s = input()

YYMM = False
MMYY = False
month = []
for i in range(1,13):
  if len(str(i))==1:
    month.append("0"+str(i))
  else:
    month.append(str(i))
    
if s[:2] in month:
  MMYY = True
  
if s[2:] in month:
  YYMM = True
  
if MMYY is True and YYMM is True:
  print("AMBIGUOUS")
elif MMYY is True and YYMM is False:
  print("MMYY")
elif MMYY is False and YYMM is True:
  print("YYMM")
else:
  print("NA")

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

Solution (Python):
s = input()
YY = "00 to 99"
MM = [str(i).zfill(2) for i in range(1, 13)]

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

Solution (Python):
S = input()
ahead = S[0:2]
post = S[2:]

if (ahead == '00' or int(ahead) > 12):
    a_judge = True
else:
    a_judge = False

if (post == '00' or int(post) > 12):
    p_judge = True
else:
    p_judge = False

if (a_judge and p_judge):
    ans = 'NA'
elif (a_judge):
    ans = 'YYMM'
elif (p_judge):
    ans = 'MMYY'
else:
    ans = 'AMBIGUOUS'

print(ans)

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

Solution (Python):
s=input()

YYMM=False
MMYY=False

month=[]
for i in range(1,13):
    if len(str(i))==1:
        month.append("0"+str(i))
    else:
        month.append(str(i))

if s[:2] in month:
    MMYY=True

if s[2:] in month:
    YYMM=True

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

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

Solution (Python):
S = input()

Sa = int(S[:2])
Sb = int(S[2:])

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

Solution (Python):
line = input()
S = list(map(int, (i for i in line)))

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

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

Solution (Python):
s = input()

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

Solution (Python):
from datetime import datetime

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

def is_month(m):
    m = int(m)
    return 0 < m < 13

def is_year(y):
    y = int(y)
    return True

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

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

Solution (Python):
S = input()


def check_mm(x):
    return (0 < int(x) and int(x) <= 12)


if check_mm(S[:2]) and check_mm(S[2:]):
    print("AMBIGUOUS")
elif check_mm(S[:2]) == False and check_mm(S[2:]):
    print("YYMM")
elif check_mm(S[:2]) and check_mm(S[2:]) == False:
    print("MMYY")
else:
    print("NA")

Solution (Python):
s = input()
l = s[:2]
r = s[2:]
yy = [str(i).zfill(2) for i in range(100)]
mm = [str(i).zfill(2) for i in range(1, 13)]

if l in mm and r in mm:
    print("AMBIGUOUS")
elif l in yy and r in mm:
    print("YYMM")
elif l in mm and r in yy:
    print("MMYY")
else:
    print("NA")

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

Solution (Python):
S=str(input())
M=int(S[0])*10+int(S[1])
Y=int(S[2])*10+int(S[3])
if M<=12 and M>0:
    if Y<=12 and Y>0:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if Y<=12 and Y>0:
        print('YYMM')
    else:
        print('NA')

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

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

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

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

Solution (Python):
s = input()

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

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

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

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

Solution (Python):
S = input()

M = [str(m).zfill(2) for m in range(1,13)]

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

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

s1=(int("".join(s[:2])))
s2=(int("".join(s[2:])))

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

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

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

def cm1(i):
    if i > 0 and i < 13:
        return(True)
    else:
        return(False)

if cm1(s1):
    if cm1(s2):
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
else:
    if cm1(s2):
        ans = "YYMM"
    else:
        ans = "NA"

print(ans)

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

Solution (Python):
S = input()
ot = S[:2]
tf = S[2:]

isotMM = 0
istfMM = 0

if 0 < int(ot) and int(ot) < 13:
    isotMM = 1
if 0 < int(tf) and int(tf) < 13:
    istfMM = 1
    
if isotMM == 1:
    if istfMM == 1:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if istfMM == 1:
        print('YYMM')
    else:
        print("NA")

Solution (Python):
s = input()

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

check1 = ((s1 <= 12) & (s1 != 0))
check2 = ((s2 <= 12) & (s2 != 0))

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

Solution (Python):
s = input()
yymm = 1
mmyy = 1
yymm2 = 1
mmyy2 = 1
if int(s[0])*10 + int(s[1])>12 or int(s[0])*10 + int(s[1])<=0:
    mmyy = 0
else:
    yymm = 1
    mmyy = 1
if int(s[2])*10 + int(s[3])>12 or int(s[2])*10 + int(s[3])<=0:
    yymm2 = 0
else:
    yymm2 = 1
    mmyy2 = 1
ans1 = mmyy * mmyy2
ans2 = yymm * yymm2
if ans1 == 1 and ans2 == 0:
    print("MMYY")
elif ans1 == 0 and ans2 == 1:
    print("YYMM")
elif ans1 == 1 and ans2 == 1:
    print("AMBIGUOUS")
else:
    print("NA")

Solution (Python):



s = input()
a = int(s[:2])
b = int(s[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):
import re
a, b = map(int, re.split('(..)', input())[1::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 = 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')

Solution (Python):
import re

arg = input()

valid_year = r"[0-9][0-9]"
valid_month = r"0[1-9]|1[0-2]"

s1_is_year = re.match(valid_year, arg[:2])
s1_is_month = re.match(valid_month, arg[:2])
s2_is_year = re.match(valid_year, arg[2:])
s2_is_month = re.match(valid_month, arg[2:])

is_yymm = s1_is_year and s2_is_month
is_mmyy = s1_is_month and s2_is_year

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

Solution (Python):
s=input()
f=int(s[:2])
b=int(s[2:])
if f>=13 or f==0:
	if 0<b and b<13:
		print("YYMM")
	else:
		print("NA")
elif 0<f and f<13:
	if 0<b and b<13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
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):
num = input()
if int(num[:2]) > 12 or int(num[:2])==0:
    if int(num[2:]) > 12 or int(num[2:])== 0:
        print('NA')
    else:
        print('YYMM')
else:
    if int(num[2:]) > 12 or int(num[2:])== 0:
        print('MMYY')
    else:
        print('AMBIGUOUS')

Solution (Python):
s = input()
mmyy, yymm = False, False
if "01" <= s[:2] <= "12":
	mmyy = True
if "01" <= s[2:] <= "12":
    yymm = True
    
if yymm and mmyy:
	print('AMBIGUOUS')
elif yymm:
	print('YYMM')
elif mmyy:
	print('MMYY')
else:
	print('NA')

Solution (Python):
s = input()
x, y = int(s[:2]), int(s[2:])

if (1 <= x <= 12) & (1 <= y <= 12):
    print('AMBIGUOUS')
elif 1 <= x <= 12:
    print('MMYY')
elif 1 <= y <= 12:
    print('YYMM')
else:
    print('NA')

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

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

Solution (Python):




def main():
    S = input()

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

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


if __name__ == "__main__":
    main()

Solution (Python):
S=list(input())
S1=S[0]+S[1]
S2=S[2]+S[3]
if 13>int(S1)>0:
  if 13>int(S2)>0:
    print("AMBIGUOUS")
  else:
    print("MMYY")
else:
  if 13>int(S2)>0:
    print("YYMM")
  else:
    print("NA")

Solution (Python):
S = input()
F,E = int(S[:2]),int(S[2:])
def j(s):
    if 0 < s <= 12:
        return 1
    else:
        return 0
R = j(F)+j(E)
if R == 0:
    print("NA")
elif R == 1:
    if j(F):
        print("MMYY")
    else:
        print("YYMM")
else:
    print("AMBIGUOUS")

Solution (Python):
S = input()
Month = []
for i in range(1,13):
    if i < 10:
        Month.append("0" + str(i))
    else:
        Month.append(str(i))
YYMMpt = 0
MMYYpt = 0
if S[0:2] in Month:
    MMYYpt += 1
if S[2:4] in Month:
    YYMMpt += 1
if YYMMpt == 0 and MMYYpt == 0:
    print("NA")
elif YYMMpt == 0 and MMYYpt == 1:
    print("MMYY")
elif YYMMpt == 1 and MMYYpt == 0:
    print("YYMM")
else:
    print("AMBIGUOUS")

Solution (Python):
S = input()

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

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

Solution (Python):
s = input()
a = s[:2]
b = s[2:]
if int(a) == 0 or int(a) > 12:
	if int(b) == 0 or int(b) > 12:
		print("NA")
	else:
		print ("YYMM")
else:
	if int(b) == 0 or int(b) > 13:
		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 (1 <= a <= 12):
  print("MMYY")
elif (1 <= b <= 12):
    print("YYMM")
else:
  print("NA")

Solution (Python):
S=input()
count = 0
cnt = 0
if int(S[2])==0 :
    if int(S[3])!=0:
        count+=1
elif int(S[2])==1:
    if int(S[3])<=2:
        count += 1
if int(S[0])==0:
    if int(S[1])!=0:
        cnt += 1
elif int(S[0])==1:
    if int(S[1])<=2:
        cnt += 1
if count == 1 and cnt == 1:
    print("AMBIGUOUS")
elif count==1:
    print("YYMM")
elif cnt==1:
    print("MMYY")
else:
    print("NA")

Solution (Python):
S=input()
a=int(S[:2])
b=int(S[2:4])
cYYMM=b>0 and b<13
cMMYY=a>0 and a<13


print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])

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

Solution (Python):
s = input()
str1 = int(s[0:2])
str2 = int(s[2:])

if (1 <= str1 <= 12) and (1 <= str2 <= 12):
    print('AMBIGUOUS')
elif (0 <= str1 <= 99) and (1 <= str2 <= 12):
    print('YYMM')
elif (1 <= str1 <= 12) and (0 <= str2 <= 99):
    print('MMYY')
else:
    print("NA")

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

Solution (Python):
def aaa(s):
  if s[0]=='0':
    if s[1]=='0':
      return 'y'
    return 'm'
  elif s[0]=='1':
    if int(s[1])<3:
      return 'm'
  return 'y'
  
s = input()
l = aaa(s[:2])
r = aaa(s[2:])
if l=='m' and r=='m':
  print('AMBIGUOUS')
elif l=='m' and r=='y':
  print('MMYY')
elif l=='y' and r=='m':
  print('YYMM')
else:
  print('NA')

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

Solution (Python):
import sys

INPUT = lambda: sys.stdin.readline().rstrip()

sys.setrecursionlimit(10 ** 9)


def main():
    S = INPUT()

    b = 0
    for i in range(2):
        if 0 < int(S[2*i:2*i+2]) <= 12: b += i + 1

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


if __name__ == '__main__':
    main()

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

Solution (Python):
s = input()

sm = int(s[0:2])
sl = int(s[2:4])

ans = [["NA", "MMYY"],
       ["YYMM", "AMBIGUOUS"]]

qm = (1 <= sm <= 12)
ql = (1 <= sl <= 12)

print(ans[ql][qm])

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

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

Solution (Python):
s = input()

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

Solution (Python):

s = input()

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

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

Solution (Python):
s = input()
x = int(s[:2])
y = int(s[2:])

if 1 <= x <= 12 and 1 <= y <= 12:
    print("AMBIGUOUS")
elif 1 <= x <= 12 and 0 <= y <= 99:
    print("MMYY")
elif 1 <= y <= 12 and 0 <= x <= 99:
    print("YYMM")
else:
    print("NA")

Solution (Python):
def isMonth(n):
    if 0<n and n<=12:return True
    else:False

s=list(input())
f=int(s[0]+s[1])
b=int(s[2]+s[3])

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

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

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

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

yymm = (1<=y<=12)
mmyy = (1<=x<=12)

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

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

yymm = (1<=y<=12)
mmyy = (1<=x<=12)

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