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()
a = s[0:2]
b = s[2:]

def to_int(i):
    if i[0] == 0:
        return int(i[1])
    else:
        return int(i)

a = to_int(a)
b = to_int(b)

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

Solution (Python):
s = input()

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

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

Solution (Python):
S = input()

left = int(S[:2])
right = int(S[2:])

a = (1 <= left <= 12)
b = (1 <= right <= 12)

if a and b:
    ans = 'AMBIGUOUS'
elif a:
    ans = 'MMYY'
elif b:
    ans = 'YYMM'
else:
    ans = 'NA'

print(ans)

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

u = int(a /100)
l = a%100

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

Solution (Python):
def is_month(s):
    return 1 <= int(s) and int(s) <= 12


s = input()

first = s[:2]
second = s[2:]

if is_month(first) and is_month(second):
    print('AMBIGUOUS')
elif is_month(first) and not is_month(second):
    print('MMYY')
elif not is_month(first) and is_month(second):
    print('YYMM')
else:
    print('NA')

Solution (Python):
s=int(input())
s1=s//100
s2=s-s1*100
if 0<s1<=12 and 0<s2<=12:
    print("AMBIGUOUS")
elif 0<s1<=12:
    print("MMYY")
elif 0<s2<=12:
    print("YYMM")
else:
    print("NA")

Solution (Python):
num = input()
num_1 = int(num[0:2])
num_2 = int(num[2:4])
ans = ["AMBIGUOUS", "MMYY", "YYMM", "NA"]
flag = 3
if 1 <= num_1 and num_1 <= 12:
  if 1 <= num_2 and num_2 <= 12:
    flag = 0
  else:
    flag = 1
else:
  if 1 <= num_2 and num_2 <= 12:
    flag = 2

print(ans[flag])

Solution (Python):
def main():
    S = input()
    month_0 = True
    month_1 = True

    if S[:2] > '12' or S[:2] <'01':
        month_0 = False
    if (S[2:] > '12' or S[2:] < '01'):
        month_1 = False

    if month_0 ==False and month_1 == True:
        print('YYMM')
    elif month_0 == True and month_1 == False:
        print('MMYY')
    elif month_0 ==False and month_1 == False:
        print('NA')
    else:
        print('AMBIGUOUS')


if __name__ == '__main__' :
    main()

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

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

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

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

judge = [0]*4

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

Solution (Python):
def main():
    s = input()
    s1 = int(s[:2])
    s2 = int(s[2:])
    isYYMM = 1 <= s2 <= 12
    isMMYY = 1 <= s1 <= 12
    if isYYMM and isMMYY:
        print("AMBIGUOUS")
    elif isYYMM:
        print("YYMM")
    elif isMMYY:
        print("MMYY")
    else:
        print("NA")


if __name__ == "__main__":
    main()

Solution (Python):
S =str(input())
top = int(S[:2])
bot = int(S[-2:])

if 1<= top <= 12:
    if 1 <= bot <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= bot <= 12:
        print("YYMM")
    else:
        print("NA")

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

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

Solution (Python):
S  = input()
MM = ['%02i' % mm for mm in range(1, 12+1)]

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):
N = list(input())
m = list(map(int,N))
a = 10*m[0] + m[1]
b = 10*m[2] + m[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):
N = list(input())
m = list(map(int,N))
a = 10*m[0] + m[1]
b = 10*m[2] + m[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):
S = input()
first = int(S[0: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):
x=int(input())

y=x//100
m=x-y*100

if y>0 and y<13:
	if m>0 and m<13:
		res='AMBIGUOUS'
	else:
		res='MMYY'
else:
	if m>0 and m<13:
		res='YYMM'
	else:
		res='NA'

print(res)

Solution (Python):
x = input().strip()
n = int(x[:2])
m = int(x[2:])



if n>=1 and n<=12 and m>=1 and m<=12:
    print('AMBIGUOUS')
elif  (n<1 or n>12) and m>=1 and m<=12 :
    print('YYMM')
elif n>=1 and n<=12 and (m<1 or m>12):
    print('MMYY')
else:
    print('NA')

Solution (Python):
S = input().strip()
first = int(S[:2])
second = int(S[2:])

def isMonth(n):
  return 1 <= n <= 12

if isMonth(first) and isMonth(second):
  print('AMBIGUOUS')
elif not(isMonth(first)) and isMonth(second):
  print('YYMM')
elif isMonth(first) and not(isMonth(second)):
  print('MMYY')
else:
  print('NA')

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

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

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

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

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

Solution (Python):
S = input()

def isYYMM(s):
    return isMM(s[2:4])

def isMMYY(s):
    return isMM(s[0:2])

def isMM(s):
    m1, m2 = list(s)
    if m1 == '0':
        if m2 == '0':
            return False
        else:
            return True
    elif m1 == '1':
        return m2 in ('0', '1', '2')
    else:
        return False
            

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

Solution (Python):
s=input()
sf=int(s[:2])
sl=int(s[2:])

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

Solution (Python):
s=input()
sf=int(s[:2])
sl=int(s[2:])

if (1<= sf <=12 and 1<=sl <=12):
  print("AMBIGUOUS")
elif 1<= sf <=12 and (sl==0 or 12<sl):
  print("MMYY")
elif 1<= sl <=12 and (sf==0 or 12<sf):
  print("YYMM")
else:
  print("NA")

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

Solution (Python):
S=int(input())
A=S//100
B=S-100*A
if A<=12 and A!=0:
    if B<=12  and B!=0:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif B<=12 and B!=0:
    print("YYMM")
else:
    print("NA")

Solution (Python):
temp = int(input())
head = temp//100
tail = temp%100

def judge(x):
  ans = ""
  if (x>12)or(x==0):
    ans="YY"
  else:
    ans="MM"
  return ans

h = judge(head)
t = judge(tail)

if h!=t:
  print(h+t)
elif h=="MM":
  print("AMBIGUOUS")
else:
  print("NA")

Solution (Python):
S=int(input())
a=S//100
b=S%100
if a==0 or a>=13:
  if b==0 or b>=13:
    print("NA")
  else:
    print("YYMM")
else:
  if b==0 or b>=13:
    print("MMYY")
  else:
    print("AMBIGUOUS")

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

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

Solution (Python):
s = input()
h = int(s[:2])
l = int(s[2:])
def mmok(i):
  return 1 <= i <= 12
if mmok(h):
  if mmok(l):
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if mmok(l):
    print('YYMM')
  else:
    print('NA')

Solution (Python):
s=input();print(["NA","YYMM","MMYY","AMBIGUOUS"][(0<int(s[2:])<13)+(0<int(s[:2])<13)*2])

Solution (Python):
S = list(map(str,input()))
first = int(S[0]+S[1])
second = int(S[2]+S[3])
fj = False
sj = False
if first >= 1 and first <= 12:
  fj = True
if second >= 1 and second <= 12:
  sj = True
if fj and sj:
  print('AMBIGUOUS')
if fj and not sj:
  print('MMYY')
if not fj and sj:
  print('YYMM')
if not fj and not sj:
  print('NA')

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

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

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

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

if judge_1_12(first) or judge_1_12(second):
    if judge_1_12(first) and judge_1_12(second):
        print("AMBIGUOUS")
    elif not judge_1_12(first):
        print("YYMM")
    else:
        print("MMYY")
else:
    print("NA")

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

Solution (Python):


s = input()

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

is_yymm = False
is_mmyy = False

if 1 <= b <= 12:
    is_yymm = True
if 1 <= a <= 12:
    is_mmyy = True

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()
a = 0
b = 0

v = str(S[:2])
u = str(S[2:])
month = ['01', '02', '03', '04', '05', '06', '07','08','09','10','11','12']
if u in month:
    a = 1
if v in month:
    b = 1
if a == 1 and b == 1:
    print('AMBIGUOUS')
if a == 1 and b == 0:
    print('YYMM')
if a == 0 and b == 1:
    print('MMYY')
if a ==0 and b == 0:
    print('NA')

Solution (Python):
s = list(input())
s = [int(i) for i in s]
mae = 0
ato = 0
if (s[0] == 0 and s[1] != 0) or (s[0] == 1 and (s[1] == 0 or s[1] == 1 or s[1] == 2)):
    mae = 1
if (s[2] == 0 and s[3] != 0) or (s[2] == 1 and (s[3] == 0 or s[3] == 1 or s[3] == 2)):
    ato = 1
if mae == 0 and ato == 1:
    print('YYMM')
if mae == 1 and ato == 0:
    print('MMYY')
if mae == 1 and ato == 1:
    print('AMBIGUOUS')
if mae == 0 and ato == 0:
    print('NA')

Solution (Python):
S = input()
def isMM(s):
  i = int(s)
  return True if 1 <= i <=12 else False
isYYMM = isMM(S[2:4])
isMMYY = isMM(S[0:2])
if isYYMM:
  if isMMYY:
    print("AMBIGUOUS")
  else:
    print("YYMM")
else:
  if isMMYY:
    print("MMYY")
  else:
    print("NA")

Solution (Python):
S = input()

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

if 1 <= A <= 12 and 1 <= B <= 12:
    print('AMBIGUOUS')
elif 1 <= A <= 12 and 0 <= B <= 99:
    print('MMYY')
elif 0 <= A <= 99 and 1 <= B <= 12:
    print('YYMM')
else:
    print('NA')

Solution (Python):
def judge_month(s):
    if '00' < s and s <= '12':
        return True
    else:
        return False

S = input()

s1 = S[0] + S[1]
s2 = S[2] + S[3] 

month_1 = judge_month(s1)
month_2 = judge_month(s2)

if month_1 and month_2:
    print('AMBIGUOUS')
elif month_1:
    print('MMYY')
elif month_2:
    print('YYMM')
else:
    print('NA')

Solution (Python):
s=int(input())
x=s//100
y=s-x*100




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

Solution (Python):
S = input()
S_front = S[:2]
S_rear = S[2:4]
S_front_int = int(S_front)
S_rear_int = int(S_rear)

YYMM_YY = False
YYMM_MM = False
MMYY_MM = False
MMYY_YY = False
YYMM = False
MMYY = False
if 0 <= S_front_int <= 99:
    YYMM_YY = True
if 1 <= S_rear_int <= 12:
    YYMM_MM = True
if 1 <= S_front_int <= 12:
    MMYY_MM = True
if 0 <= S_rear_int <= 99:
    MMYY_YY = True
if YYMM_YY == True and YYMM_MM == True:
    YYMM = True
if MMYY_MM == True and MMYY_YY == True:
    MMYY = True
if YYMM == True and MMYY == True:
    print('AMBIGUOUS')
elif YYMM == False and MMYY == False:
    print('NA')
elif YYMM == True and MMYY == False:
    print('YYMM')
elif YYMM == False and MMYY == True:
    print('MMYY')

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

if 0 < S1 and S1 < 13:
	if 0 < S2 and S2 < 13:
		print("AMBIGUOUS")
	else:
		print("MMYY")
else:
	if 0 < S2 and S2 < 13:
		print("YYMM")
	else:
		print("NA")

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

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

Solution (Python):
s = int(input())
s1 = s//100
s2 = s%100

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

Solution (Python):
S = input()


def yymm(S):
    yy = int(S[:2])
    mm = int(S[2:])
    return yy >= 0 and (mm >= 1 and mm <= 12)


def mmyy(S):
    mm = int(S[:2])
    yy = int(S[2:])
    return yy >= 0 and (mm >= 1 and mm <= 12)


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

Solution (Python):
S = input()
a = int(S[:2]) < 13 and S[:2] != '00'
b = int(S[2:]) < 13  and S[2:] != '00'


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

Solution (Python):
s = input()
fro = int(s[:2])
bac = int(s[2:])

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

Solution (Python):
S = input()
s = int(S[0:2])
t = int(S[2:4])

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

Solution (Python):
S = input()
d1 = int(S[:2])
d2 = int(S[2:])

m = lambda d:d>0 and d<13

if m(d1):
    if m(d2):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if m(d2):
        print("YYMM")
    else:
        print("NA")

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

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

else:
    print('NA')

Solution (Python):
S = input()
upper_S = int(S[0:2])
lower_S = int(S[2:4])

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

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

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

if (x > 12 and y > 12 ) or (x==0 and y==0) or (x>12 and y==0) or (y>12 and x==0):
  print("NA")
elif x<13 and (y>12 or y==0):
  print("MMYY")
elif (x>12 or x==0) and y<13:
  print("YYMM")
elif x<13 and y<13:
  print("AMBIGUOUS")

Solution (Python):
S = input()

if 0 < int(S[:2]) <= 12:
    if 0 < int(S[2:]) <=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 0 < int(S[2:]) <=12:
        print('YYMM')
    else:
        print('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):
n = input()

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

Solution (Python):
x = input()

if int(x[0:2]) <= 12 and int(x[0:2])>0:
  a = True
else:
  a = False
      
if int(x[2:4]) <= 12 and int(x[2:4])>0:
  b = True
else:
  b = False
  
if(a and b):
  print("AMBIGUOUS")
  
elif( not a and b):
  print("YYMM")
  
elif( a and not b):
  print("MMYY")
  
else:
  print("NA")

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

if 1<=head<=12:
    if 1<=tail<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=tail<=12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
s = input()
sp = s[:2]
ss = s[2:]
m = ["{0:02d}".format(i) for i in range(1,13)]
def check(s):
    if s in m:
        return True

sp_c = check(sp)
ss_c = check(ss)

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

Solution (Python):

s = input()
s_up = int(s[0] + s[1])
s_down = int(s[2] + s[3])

if 0 < s_up <= 12 and 0 < s_down <= 12:
    print("AMBIGUOUS")
elif 0 < s_down <= 12:
    print("YYMM")
elif 0 < s_up<= 12:
    print("MMYY")
else:
    print("NA")

Solution (Python):
import math
 
S = int(input())
 
first_half = math.floor(S / 100)
second_half = S - first_half * 100
 
if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
elif 1 <= second_half <= 12 :
   		print("YYMM")
elif 1 <= first_half <= 12 :
    	print("MMYY")
else: 
        print("NA")

Solution (Python):
import math

S = int(input())

first_half = math.floor(S / 100)
second_half = S - first_half * 100

if 1 <= second_half <= 12 and 1 <= first_half <= 12 :
  print("AMBIGUOUS")
elif 1 <= second_half <= 12 :
   		print("YYMM")
elif 0 == first_half or 12 < first_half :
    	print("NA")
else: 
        print("MMYY")

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

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

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

Solution (Python):
S = input()
flg1 = 1 <= int(S[:2]) <= 12
flg2 = 1 <= int(S[2:]) <= 12

if flg1 and flg2:
    print('AMBIGUOUS')
elif flg1 and not flg2:
    print('MMYY')
elif not flg1 and flg2:
    print('YYMM')
else:
    print('NA')

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

Solution (Python):
s = input()
a = s[0:2]
b = s[2:4]
ans = ''
for i in [int(a), int(b)]:
        if 1 <= i <= 12:
                ans = ans + 'MM'
        else:
                ans = ans + 'YY'
if ans == 'YYYY':
        ans = 'NA'
elif ans == 'MMMM':
        ans = 'AMBIGUOUS'

print(ans)

Solution (Python):
S = input()



if 0 < int(S[:2]) <= 12:
    temp = "both"
else:
    temp = "YY"
    
if 0 < int(S[2:4]) <= 12:
    temp2 = "both"
else:
    temp2 = "YY"
    
if temp == "both" and temp2 == "both":
    print("AMBIGUOUS")
elif temp == "both" and temp2 == "YY":
    print("MMYY")
elif temp == "YY" and temp2 == "both":
    print("YYMM")
else:
    print("NA")

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

Solution (Python):
s = input()

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

Solution (Python):
x = input()
erl = int(x[:2])
lat = int(x[2:4])

def ymjudge(date):
    return date <= 12 and date != 0 

if ymjudge(erl):
    if not ymjudge(lat):
        print("MMYY")
    else:
        print("AMBIGUOUS")
elif ymjudge(lat):
    if not ymjudge(erl):
        print("YYMM")
    else:
        print("AMBIGUOS")
else:
    print("NA")

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

Solution (Python):
import sys
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    head = int(inputs[0][:2])
    tail = int(inputs[0][2:])

    if head >= 1 and head <= 12:
        if tail >= 1 and tail <= 12:
            return "AMBIGUOUS"
        else:
            return "MMYY"

    if tail >= 1 and tail <= 12:
        return "YYMM"

    return "NA"


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

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

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

def in_month(n):
    return 1 <= n <= 12

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

Solution (Python):
def judge(s):
    if int(s[0]) == 0:
        if int(s[1]) > 0:
            return 1
        else:
            return 0
    elif int(s[0]) == 1:
        if int(s[1]) <=2:
            return 1
        else:
            return 0
    else:
        return 0

S = input()
tmp = list(S)
first = ''.join([tmp[0],tmp[1]])
second = ''.join([tmp[2],tmp[3]])

flag1 = -1
flag2 = -1


flag1 = judge(second)


flag2 = judge(first)


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

Solution (Python):
S = input()

Y = False
M = False
if 1 <= int(S[:2]) <= 12:
    Y = True
if 1 <= int(S[2:]) <= 12:
    M = True

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

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

Y = s//100
M = s%100
flag=0

if(M!=0 and M<13):
    flag+=1

if(Y!=0 and Y<13):
    flag+=2

if(flag==0):
    print('NA')
elif(flag==1):
    print('YYMM')
elif(flag==2):
    print('MMYY')
elif(flag==3):
    print('AMBIGUOUS')

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

prev = s // 100
late = s % 100

flag1 = False
flag2 = False

if prev >= 1 and prev <= 12:
    flag1 = True
if late >= 1 and late <= 12:
    flag2 = True

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

Solution (Python):
S=str(input())
A=int(S[0]+S[1])
B=int(S[2]+S[3])

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

Solution (Python):
S = input()

mm = ['0' + str(x) for x in range(1,10)] + ['10','11','12']

mmyy = (S[:2] in mm)
yymm = (S[2:] in mm)

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

Solution (Python):
s = str(input())
ss = s[:2]
sss = s[2:]

if "01" <= sss <= "12":
    if "01" <= ss <= "12":
        print("AMBIGUOUS")
        exit()
    else:
        print("YYMM")
        exit()
if "01" <= ss <= "12":
    print("MMYY")
else:
    print("NA")

Solution (Python):
def main():
    S = input()
    YY = int(S[:2])
    MM = int(S[2:])

    if 1 <= YY <= 12:
        if 1 <= MM <= 12:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 1<= MM <= 12:
            print("YYMM")
        else:
            print("NA")


if __name__ == '__main__':
    main()

Solution (Python):
def test(A, B):
    if((A > 0 and A <= 12) and (B > 0 and B <= 12)):
        print("AMBIGUOUS")
        return

    if((B > 0 and B <= 12)):
        print("YYMM")
        return

    if ((A > 0 and A <= 12)):
        print("MMYY")
        return

    print("NA")


S = list(input())
A = int(S[0] + S[1])
B = int(S[2] + S[3])
test(A, B)

Solution (Python):
def test(A, B):
    if((A > 0 and A <= 12) and (B > 0 and B <= 12)):
        print("AMBIGUOUS")
        return

    if(not(A > 0 and A <= 12) and (B > 0 and B <= 12)):
        print("YYMM")
        return

    if ((A > 0 and A <= 12) and (not (B > 0 and B <= 12))):
        print("MMYY")
        return

    print("NA")


S = list(input())
A = int(S[0] + S[1])
B = int(S[2] + S[3])





test(A, B)

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

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

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

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

ans = "NA"

if 1 <= s[0] * 10 + s[1] <= 12 and 1 <= s[2] * 10 + s[3] <= 12:
    ans = "AMBIGUOUS"
elif 1 <= s[0] * 10 + s[1] <= 12:
    ans = "MMYY"
elif 1 <= s[2] * 10 + s[3] <= 12:
    ans = "YYMM"

print(ans)

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

Solution (Python):
S = input()

A = S[:2]
B = S[2:] 

if int(A) >= 1 and int(A) <= 12 and int(B) >= 1 and int(B) <= 12:
  print('AMBIGUOUS')
elif int(A) >= 1 and int(A) <= 12:
  print('MMYY')
elif int(B) >= 1 and int(B) <= 12:
  print('YYMM')
else:
  print('NA')

Solution (Python):
S = input()

S_mae = int(S[:2])
S_ushiro = int(S[2:])

flg_MMYY = 0
flg_YYMM = 0
if 1 <= S_mae and S_mae <= 12:
    flg_MMYY = 1
    if 1 <= S_ushiro and S_ushiro <= 12:
        flg_YYMM = 1
        print('AMBIGUOUS')
    else:
        print('MMYY')
elif 1 <= S_ushiro and S_ushiro <= 12:
    flg_YYMM = 1
    print('YYMM')

else:
    print('NA')

Solution (Python):


S = input()

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

Solution (Python):



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

front = int(s[:2])
back = int(s[2:])

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

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

Solution (Python):
S = int(input())
up = S//100
down = S%100
if 0<up<13 and 0 <down<13:
    print("AMBIGUOUS")
elif 0<up<13:
    print("MMYY")
elif 0<down<13:
    print("YYMM")
else:
    print("NA")

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

aa=N//100
bb=N%100

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