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 = 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()
f = int(S[0]+S[1])
b = int(S[2]+S[3])

def judge(int):
    if 1 <= int <= 12:
        return 0
    else:
        return 1
ref = [judge(f), judge(b)]

if ref == [1, 1]:
    print("NA")
elif ref == [0, 1]:
    print("MMYY")
elif ref == [1, 0]:
    print("YYMM")
else:
    print("AMBIGUOUS")

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

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

Solution (Python):
def solve(yy,mm):
    if 1<=yy<=12:
        if 1 <= mm <=12:
            return 'AMBIGUOUS'
        else:
            return 'MMYY'
    else:
        if 1<= mm <= 12:
            return 'YYMM'
        else:
            return "NA"


s = input()
yy = int(s[:2])
mm = int(s[2:])
print(solve(yy,mm))

Solution (Python):
s = input()
flg1 = 1 <= int(s[:2]) <= 12
flg2 = 1 <= int(s[2:]) <= 12
l = ["NA", "YYMM", "MMYY", "AMBIGUOUS"]
print(l[(flg1 << 1) + flg2])

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

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

a_is_month = 0 < a & a <= 12
b_is_month = 0 < b & b <= 12

if a_is_month:
    if b_is_month:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if b_is_month:
        print("YYMM")
    else:
        print("NA")

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

Solution (Python):
s = input()

l = list(s)

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

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

Solution (Python):
s = input()
F, T = False, True
ans = {(F, F): 'NA', (F, T): 'YYMM', (T, F): 'MMYY', (T, T): 'AMBIGUOUS'}
print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12])

Solution (Python):
s = input()
ans = {(False, False): 'NA', (False, True): 'YYMM', (True, False): 'MMYY', (True, True): 'AMBIGUOUS'}
print(ans[1 <= int(s[:2]) <= 12, 1 <= int(s[2:]) <= 12])

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

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    s = S()
    if int(s[:2]) > 12 or int(s[:2]) == 0:
        mmyy = False
    else:
        mmyy = True
    if int(s[2:]) > 12 or int(s[2:]) == 0:
        yymm = False
    else:
        yymm = True
    ans = ''
    if yymm and mmyy:
        ans = 'AMBIGUOUS'
    if yymm and not mmyy:
        ans = 'YYMM'
    if not yymm and mmyy:
        ans = 'MMYY'
    if not yymm and not mmyy:
        ans = 'NA'
    print(ans)
        

main()

Solution (Python):


s = input()

head = s[:2]
tail = s[2:]

result = ['MMYY', 'YYMM', 'AMBIGUOUS', 'NA']
judge = [0, 0]
months = [f'{m:02}' for m in range(1, 13)]
if head in months:
    judge[0] += 1
if tail in months:

    judge[1] += 1


if sum(judge) == 2:
    print(result[2])

elif sum(judge) == 0:
    print(result[3])
else:
    print(result[judge.index(1)])

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

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

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

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

Solution (Python):



s = int(input())

yy = s // 100
mm = s % 100

if 1 <= yy <= 12:
    if 1 <= mm <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1 <= mm <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = str(input())
front = int(S[:2])
back = int(S[2:])

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

Solution (Python):
S = str(input())
front = int(S[:2])
back = int(S[2:])
S_list = list(S)

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

Solution (Python):
S=input()
first = S[:2]
second= S[2:]
ans=""


if int(first) > 12 or int(first) == 0:
	if int(second) <= 12 and int(second) >= 1:
		ans="YYMM"
	if int(second) > 12 or int(second) == 0:
		ans="NA"

elif int(first) <= 12 and int(first) >= 1:
	if int(second) <= 12 and int(second) >= 1:
		ans="AMBIGUOUS"
	if int(second) > 12 or int(second) == 0:
		ans="MMYY"

print(ans)

Solution (Python):
s = input()

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

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

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

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

Solution (Python):
import sys
S = list(map(int,input()))

if len(S) != 4: sys.exit()

if 1 <= int(str(S[0])+str(S[1])) <= 12 and 1 <= int(str(S[2])+str(S[3])) <= 12: print('AMBIGUOUS');sys.exit()
if int(str(S[0])+str(S[1])) >= 13 and 1 <= int(str(S[2])+str(S[3])) <= 12: print('YYMM');sys.exit()
if 0 == int(str(S[0])+str(S[1])) and 1 <= int(str(S[2])+str(S[3])) <= 12: print('YYMM');sys.exit()
if 1 <= int(str(S[0])+str(S[1])) <= 12 and 13 <= int(str(S[2])+str(S[3])): print('MMYY');sys.exit()
if 1 <= int(str(S[0])+str(S[1])) <= 12 and 0 == int(str(S[2])+str(S[3])): print('MMYY');sys.exit()
print('NA')

Solution (Python):
S = input()

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

Solution (Python):
S=input()
Y=int(S[:2])
M=int(S[2:])
if Y==0 or Y>12:
    
    if M==0 or M>12:
        print("NA")
    else:
        print("YYMM")
else:
    if M==0 or M>12:
        print("MMYY")
    else:
        print("AMBIGUOUS")

Solution (Python):
def main():
    S = input().rstrip()
    v1 = int(S[:2])
    v2 = int(S[2:])
    if 1 <= v1 <= 12 and 1 <= v2 <= 12:
        print("AMBIGUOUS")
    elif 1 <= v1 <= 12 and (v2 >= 13 or v2 == 0):
        print("MMYY")
    elif (v1 >= 13 or v1 == 0) and 1 <= v2 <= 12:
        print("YYMM")
    else:
        print("NA")


if __name__ == '__main__':
    main()

Solution (Python):
import sys
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  

S = LI2()

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

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

Solution (Python):
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = read().rstrip().decode()

is_YYMM = 1 <= int(S[2:]) <= 12
is_MMYY = 1 <= int(S[:2]) <= 12

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 = 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):
def check_my(string):
    if 1 <= int(string) <= 12:
        return 'YorM'
    else:
        return 'Y'

s = input()
my_set = (check_my(s[0:2]), check_my(s[2:4]))
if my_set == ('YorM', 'YorM'):
    print('AMBIGUOUS')
elif my_set == ('YorM', 'Y'):
    print('MMYY')
elif my_set == ('Y', 'YorM'):
    print('YYMM')
else:
    print('NA')

Solution (Python):
s = input()
upper_input = int(s[:2])
lower_input = int(s[2:])

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

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

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

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

def main():
    s = input()
    month = [i for i in range(1, 13)]
    if int(s[:2]) not in month and int(s[2:]) in month:
        print('YYMM')
    elif int(s[:2]) in month and int(s[2:]) not in month:
        print('MMYY')
    elif int(s[:2]) in month and int(s[2:]) in month:
        print('AMBIGUOUS')
    else:
        print('NA')
    
if __name__ == '__main__':
    main()

Solution (Python):
s = input()

i1 = int(s[:2])
i2 = int(s[2:])



def f(i):
    if (0 < i < 13):
        return 1
    elif (0 < i < 100):
        return 2
    else:
        return 0


f1 = f(i1)
f2 = f(i2)

if (f1 == 1):
    if (f2 == 1):
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if (f2 == 1):
        print("YYMM")
    else:
        print("NA")

Solution (Python):


S = input()

yy = int(S[0:2])
mm = int(S[2:])

yymm = False
mmyy = False

if yy > 0 and yy < 13:
    mmyy = True
if mm > 0 and mm < 13:
    yymm = True

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

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

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

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

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

Solution (Python):
S=input()
months=['01','02','03','04','05','06','07','08','09','10','11','12']

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

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

Solution (Python):
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
a, b = int(s[:2]), int(s[2:])
if 0 < a < 13:
  if 0 < b < 13:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 0 < b < 13:
    print('YYMM')
  else:
    print('NA')

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

heads = int(S[:2])
tails = int(S[2:])


def is_month(n):
    return n >= 1 and n <= 12


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

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

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

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

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

Solution (Python):

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

S = input()

head = int(S[:2])
tail = int(S[2:])
head_mm = mm(head)
tail_mm = mm(tail)
if head_mm and tail_mm:
    print("AMBIGUOUS")
elif head_mm:
    print("MMYY")
elif tail_mm:
    print("YYMM")
else:
    print("NA")

Solution (Python):
S=int(input())
x=S//100
y=S%100
yymm=1<=y<=12
mmyy=1<=x<=12
ans=""
if yymm and mmyy:
    ans="AMBIGUOUS"
elif yymm:
    ans="YYMM"
elif mmyy:
    ans="MMYY"
else:
    ans="NA"
print(ans)

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

Solution (Python):
s = input()

s1 = int(s[0])*10 + int(s[1])
s2 = int(s[2])*10 + int(s[3])

if  (s1>12 or s1==0) and (s2>12 or s2==0):
  print('NA')
elif (s1>12 or s1==0) and 1<=s2<=12:
  print('YYMM')
elif (s2>12 or s2==0) and 1<=s1<=12:
  print('MMYY')
elif 1<=s1<=12 and 1<=s2<=12:
  print('AMBIGUOUS')

Solution (Python):
S = input()
month_list = ["01","02","03","04","04","05","06","07","08","09","10","11","12"]

if S[0:2] in month_list:
    if S[2:4] in month_list:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if S[2:4] in month_list:
        print("YYMM")
    else:
        print("NA")

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

d2 = n % 100
u2 = n // 100

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

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

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

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)
a = "NA"

if yymm and mmyy:
  a = "AMBIGUOUS"
elif yymm:
  a = "YYMM"
elif mmyy:
  a = "MMYY"
  
print(a)

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

Solution (Python):
s = input()

a = (1 <= int(s[:2]) <= 12)
b = (1 <= int(s[2:]) <= 12)

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

Solution (Python):
import re
s = input()
f = s[:2]
b = s[2:]
flg_fm = False
flg_bm = False

if f[0] == '0' and bool(re.search('[1-9]', f[1])) or f[0] == '1' and bool(re.search('[0-2]', f[1])):
    flg_fm = True
if b[0] == '0' and bool(re.search('[1-9]', b[1])) or b[0] == '1' and bool(re.search('[0-2]', b[1])):
    flg_bm = True

if flg_fm and flg_bm:
    print('AMBIGUOUS')
elif flg_bm:
    print('YYMM')
elif flg_fm:
    print('MMYY')
else:
    print('NA')

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

Solution (Python):
import sys
import heapq
import re
from itertools import permutations
from bisect import bisect_left, bisect_right
from collections import Counter, deque
from math import factorial, sqrt, ceil, gcd
from functools import lru_cache, reduce
from decimal import Decimal
from operator import mul

INF = 1 << 60
MOD = 1000000007
sys.setrecursionlimit(10 ** 7)



class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


def dijkstra_heap(s, edge, n):
    
    d = [10**20] * n
    used = [True] * n 
    d[s] = 0
    used[s] = False
    edgelist = []
    for a,b in edge[s]:
        heapq.heappush(edgelist,a*(10**6)+b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        
        if not used[minedge%(10**6)]:
            continue
        v = minedge%(10**6)
        d[v] = minedge//(10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v])*(10**6)+e[1])
    return d


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def combinations_count(n, r):
    if n < r:
        return 0
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def lcm(x, y):
    return (x * y) // gcd(x, y)


def lcm_list(numbers):
    return reduce(lcm, numbers, 1)


def gcd_list(numbers):
    return reduce(gcd, numbers)


def is_prime(n):
    if n <= 1:
        return False
    p = 2
    while True:
        if p ** 2 > n:
            break
        if n % p == 0:
            return False
        p += 1
    return True



def eratosthenes(limit):
    A = [i for i in range(2, limit+1)]
    P = []

    while True:
        prime = min(A)
        
        if prime > sqrt(limit):
            break
            
        P.append(prime)
            
        i = 0
        while i < len(A):
            if A[i] % prime == 0:
                A.pop(i)
                continue
            i += 1
            
    for a in A:
        P.append(a)
            
    return P


def permutation_with_duplicates(L):

    if L == []:
        return [[]]

    else:
        ret = []

        
        S = sorted(set(L))

        for i in S:

            data = L[:]
            data.remove(i)

            for j in permutation_with_duplicates(data):
                ret.append([i] + j)

        return ret

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


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

Solution (Python):
s = input()
a = 0
b = 0

if s[2] == '0': b = int(s[3])
else: b = int(s[2:])
if s[0] == '0': a = int(s[1])
else: a = int(s[:2])

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

Solution (Python):
s = input()
a = s[:2]
b = s[2:]
b1 = 0
a1 = 0

if b[0] == '0': b1 = int(b[1])
else: b1 = int(b)
if a[0] == '0': a1 = int(a[1])
else: a1 = int(a)

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

Solution (Python):
s=input()

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

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
s = input()
mae = int(s[:2])
usiro = int(s[2:])

ym = 0
my = 0

if (1 <= usiro <= 12): ym = 1
if (1 <= mae <= 12): my = 1

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

Solution (Python):

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

Solution (Python):
s = input()
n1 = int(s[0:2])
n2 = int(s[2:4])

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

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

Solution (Python):
s = input()

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

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

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

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

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

Solution (Python):
S = input()

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

Solution (Python):
x = input()
a, b = int(x[0:2]), int(x[2:4])
flag = 0
ans = ["AMBIGUOUS", "YYMM", "MMYY", "NA"]

if (a >= 1 and a <= 12) and (b >= 1 and b <= 12):
    flag = 0
elif (a == 0 and b > 12) or (b == 0 and a > 12) or (b > 12 and a > 12) or (b == 0 and a == 0):
    flag = 3
elif ((a > 0 and a <= 12) and (b >= 13)) or (b == 0 and (a >= 1 and a <= 12)):
    flag = 2
elif ((a >= 13) and (b > 0 and b <= 12)) or (a == 0 and (b >= 1 and b <= 12)):
    flag = 1


print(ans[flag])

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

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

Solution (Python):
x = list(input())
first = 10 * int(x[0]) + int(x[1])
second = 10 * int(x[2]) + int(x[3])


def mc(num):
    if 1 <= num <= 12:
        return True
    else:
        return False


def yc(num):
    if 0 <= num <= 99:
        return True
    else:
        return False


if yc(first):
    if mc(second):
        if yc(second):
            if mc(first):
                print("AMBIGUOUS")
            else:
                print("YYMM")
        else:
            print("YYMM")
    elif yc(second):
        if mc(first):
            print("MMYY")
        else:
            print("NA")
    else:
        print("NA")
elif yc(second):
    if mc(first):
        print("MMYY")
    else:
        print("NA")
else:
    print("NA")

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

S = input()

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

if (f <= 0 and s > 12) or (f > 12 and s <= 0) or (f <= 0 and s <= 0) or (f > 12 and s > 12):
    print("NA")  
elif (f > 12 and 0 < s <= 12) or (f <= 0 and 0 < s <= 12):
    print("YYMM")
elif (0 < f <= 12 and s > 12) or (0 < f <= 12 and s <= 0):
    print("MMYY")
elif 0 < f <= 12 and 0 < s <= 12:
    print("AMBIGUOUS")