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 = list(input())
a,b = "",""
f1,f2 = False,False
for i in range(2):
    a += s[i]
    b += s[i+2]
if 0<int(a)<13:
    f1 = True
if 0<int(b)<13:
    f2 = True
if f1 and f2:
    print("AMBIGUOUS")
elif f1:
    print("MMYY")
elif f2:
    print("YYMM")
else:
    print("NA")

Solution (Python):
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 = list(input())
AA = int(S[0])*10+int(S[1])
BB = int(S[2])*10+int(S[3])

ans = ""

if AA < 13 and AA != 0 and BB < 13 and BB != 0:
    ans = "AMBIGUOUS"
elif (AA >= 13 or AA == 0)and BB <13 and BB != 0:
    ans = "YYMM"
elif AA < 13 and AA != 0 and (BB >= 13 or BB == 0):
    ans = "MMYY"
else:
    ans = "NA"

print(ans)

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

left_s = S[:2]
right_s = S[2:]



YYMM = False
MMYY = False


if int(left_s) >= 0 and 99 >= int(left_s) and int(right_s) > 0 and 12 >= int(right_s):
    YYMM = True

if int(left_s) > 0 and 12 >= int(left_s) and int(right_s) >= 0 and 99 >= int(right_s):
    MMYY = True

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

Solution (Python):
S = input()

p1 = int(S[:2])
p2 = int(S[2:])


if (1 <= p1 <= 12) or (1 <= p2 <= 12):
    if (1 <= p1 <= 12) and (1 <= p2 <= 12):
        print('AMBIGUOUS')
    elif 1 <= p1 <= 12:
        print('MMYY')
    else:
        print('YYMM')
else:
    print('NA')

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

Solution (Python):
s=list(map(int,input()))
a=10*s[0]+s[1]
b=10*s[2]+s[3]
counta=0
countb=0
'''month'''
if 0<a<=12:
    counta+=1
if 0<b<=12:
    countb+=1
'''year'''
if a==0 or a>=13:
    counta+=5
if b==0 or b>=13:
    countb+=5
j=counta+countb
if j==2:
    print('AMBIGUOUS')
elif j==6 and counta==5:
    print('YYMM')
elif j==6 and countb==5:
    print('MMYY')
else:
    print('NA')

Solution (Python):
s = input()

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

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

Solution (Python):
s = input()

m = {str(i).zfill(2) for i in range(1,13)}
y = {str(i).zfill(2) for i in range(13,100)}

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

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

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

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

Solution (Python):
m = ["{:02}".format(i) for i in range(1, 13)]
s = input()
a = s[:2] in m
b = s[2:] in m
ans = "NA"

if a and b:
    ans = "AMBIGUOUS"
elif a:
    ans = "MMYY"
elif b:
    ans = "YYMM"

print(ans)

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

Solution (Python):
S = input()

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

Solution (Python):
def is_month(input_str):
  if 1 <= int(input_str) and int(input_str) <= 12:
    return True
  else:
    return False
    
def is_year(input_str):
  if 0 <= int(input_str) and int(input_str) <= 99:
    return True
  else:
    return False

s=input().strip()
first_half = [is_month(s[:2]), is_year(s[:2])]
second_half = [is_month(s[2:]), is_year(s[2:])]

if (first_half == [True, True] and second_half == [True, True]):
  print('AMBIGUOUS')
elif first_half[0] is True and second_half[1] is True:
  print('MMYY')
elif first_half[1] is True and second_half[0] is True:
  print('YYMM')
else:
  print('NA')

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

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

Solution (Python):
day = input()

aa = day[:2]
bb = day[2:]

if 1 <= int(aa) <= 12 and 1 <= int(bb) <= 12:
  print('AMBIGUOUS')
elif 1 <= int(aa) <= 12 and 0 <= int(bb) <= 99:
  print('MMYY')
elif 0 <= int(aa) <= 99 and 1 <= int(bb) <= 12:
  print('YYMM')
else:
  print('NA')

Solution (Python):
s = str(input())
f,l = int(s[0:2]),int(s[2:4])
k = 0
if 1 <= f <= 12:
  k += 1
if 1 <= l <= 12:
  k += 2
if k == 0:
  print("NA")
elif k == 1:
  print("MMYY")
elif k == 2:
  print("YYMM")
else:
  print("AMBIGUOUS")

Solution (Python):
S = input()

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

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

import heapq

def main(): 

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


if __name__ == "__main__":
    main()

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

Solution (Python):
lst = list(input())
lst1 = []
lst1.append(lst[0]+lst[1])
lst1.append(lst[2]+lst[3])

if (int(lst1[0]) >=13 and int(lst1[1]) >=13) or (int(lst1[0]) >=13 and lst1[1] =="00") or (lst1[0] =="00" and int(lst1[1]) >=13) or (lst1[0] =="00" and lst1[1] == "00"):
  print("NA")
  
elif (0<int(lst1[0])<=12 and 0<int(lst1[1])<=12):
      print("AMBIGUOUS")
      
elif 0<int(lst1[0]) <=12:
      print("MMYY")
elif 0<int(lst1[1])<=12:
      print("YYMM")

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

def f(x):
	if x>0 and x<13:return True
	else: return False

if f(a):
	if f(b):print('AMBIGUOUS')
	else:print('MMYY')
else:
	if f(b):print('YYMM')
	else:print('NA')

Solution (Python):
S = input()

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

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

Solution (Python):
YYMM = input()
YY = int(YYMM[:2])
MM = int(YYMM[2:])

if 0<YY and YY<13:
    if 0<MM and MM<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 0<MM and MM<13:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = input()
S1 = int(S[:2])
S2 = int(S[2:])
b1,b2 = False,False
if 1 <= S1 <= 12:
    b1 = True
if 1 <= S2 <= 12:
    b2 = True
print('AMBIGUOUS' if b1 and b2 else 'YYMM' if b2 else 'MMYY' if b1 else 'NA')

Solution (Python):
S = list(input())
A, B = int(S[0]+S[1]), int(S[2]+S[3])
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 = int(input())


up = s // 100

down = s % 100


if  up >= 1 and up <= 12 and down >=1 and down <= 12:
    print("AMBIGUOUS")

elif (up == 0 or up > 12 ) and (down == 0 or down > 12):
    print("NA")


elif up >= 1 and up <=12:
    print("MMYY")

else:
    print("YYMM")

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

A = int(''.join(S[:2]))
B = int(''.join(S[2:]))

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

print(ans)

Solution (Python):
s = input()

y,m = int(s[:2]), int(s[2:])

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

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

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

Solution (Python):
def main():
    S = input()
    s1, s2 = S[:2], S[2:]
    months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]
    if s1 in months and s2 in months:
        return "AMBIGUOUS"
    elif s1 in months:
        return "MMYY"
    elif s2 in months:
        return "YYMM"
    else:
        return "NA"

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

Solution (Python):
def test():
    n = list(input())
    a = int(n[0]+n[1])
    b = int(n[2]+n[3])
    if a > 12 or a == 0:
        if b == 0 or b > 12:
            print("NA")
        else:
            print("YYMM")
    elif a <= 12:
        if b <= 12 and b != 0:
            print("AMBIGUOUS")
        elif b > 12 or b == 0:
            print("MMYY")


if __name__ == "__main__":
    test()

Solution (Python):

S=input()
A=S[0]+S[1]
B=S[2]+S[3]
if 0<int(A)<13:
    if 0<int(B)<13:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif 0<int(B)<13:
    print("YYMM")
else:
    print("NA")

Solution (Python):
s=input()
a=0
b=0
if(s[0]=='0' and s[1]!='0'):
  a=1
elif(s[0]=='1' and (s[1]=='0' or s[1]=='1' or s[2]=='2')):
  a=1

if(s[2]=='0' and s[3]!='0'):
  b=1
elif(s[2]=='1' and (s[3]=='0' or s[3]=='1' or s[3]=='2')):
  b=1
  
if(a==1 and b==1):
  print("AMBIGUOUS")
elif(a==1 and b==0):
  print("MMYY")
elif(a==0 and b==1):
  print("YYMM")
else:
  print("NA")

Solution (Python):
s = input()

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

s1 = s[0:2]
s2 = s[2:4]

if s1 in M:
    if s2 in M:
        print("AMBIGUOUS")
    else:
        print("MMYY")
elif s2 in M:
    if s1 in M:
        print("AMBIGUOUS")
    else:
        print("YYMM")
else:
    print('NA')

Solution (Python):
s=input()
a=s[:2]
b=s[2:]
MMYY=0
YYMM=0


MMYY=1 if int(a)<=12 and int(a)>0 else 0
YYMM=1 if int(b)<=12 and int(b)>0 else 0

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

Solution (Python):
S = input()
fore = int(S[:2])
aft = int(S[2:])

if (fore == 0 or 13 <= fore <= 99) and 1 <= aft <= 12:
    print("YYMM")
elif 1 <= fore <= 12 and (aft == 0 or 13 <= aft <= 99):
    print("MMYY")
elif 1 <= fore <= 12 and 1 <= aft <= 12:
    print("AMBIGUOUS")
else:
    print("NA")

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

Solution (Python):
n=input()
N=int(n[0]+n[1])
M=int(n[2]+n[3])
if 0<N<13 and 0<M<13:
    print("AMBIGUOUS")
elif 0<N<13:
    print("MMYY")
elif 0<M<13:
    print("YYMM")
else:
    print("NA")

Solution (Python):


def main():
    S = input()

    S1 = int(S[:2])
    S2 = int(S[2:])
    
    if 0 < S1 and S1 < 13 and 0 < S2 and S2 < 13:
        return 'AMBIGUOUS'
    elif 0 < S1 and S1 < 13:
        return 'MMYY'
    elif 0 < S2 and S2 < 13:
        return 'YYMM'
    else:
        return 'NA'

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

Solution (Python):
s = input()
seq = list(map(int, (s[:2], s[2:])))

ans = ["", ""]

for i in range(2):
    if 0 < seq[i] <= 12:
        ans[i] = "MM"
    else:
        ans[i] = "YY"

if "MM" not in ans:
    print("NA")
elif "YY" not in ans:
    print("AMBIGUOUS")
else:
    print("".join(ans))

Solution (Python):



S = input()
first = int(S[0:2])
last = int(S[2::])
 
if first >= 1 and first <= 12:
    if last >= 1 and last <= 12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if last >= 1 and last <= 12:
        print("YYMM")
    else:
        print("NA")

Solution (Python):
S = int(input())
A = S // 100
B = S % 100
MMA = False
MMB = False
if 1 <= A and A <= 12:
  MMA = True
if 1 <= B and B <= 12:
  MMB = True

if MMA and MMB:
  print('AMBIGUOUS')
elif MMA and not(MMB):
  print('MMYY')
elif not(MMA) and MMB:
  print('YYMM')
else:
  print('NA')

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

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

Solution (Python):

import sys
import math
from collections import defaultdict


sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


mod = 10**9 + 7


def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))




S = str(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')
        exit()
    else:
        print('NA')
        exit()

Solution (Python):

S = list(input())
FF = ''
RR = ''
J = [0] * 2

for st in S[0],S[1]:
	FF += st

for st in S[2],S[3]:
	RR += st

if 1 <= int(FF) <= 12:
	J[0] = 1
else:
	J[0] = 0

if 1 <= int(RR) <= 12:
	J[1] = 1
else:
	J[1] = 0

if J[0] == 0 and J[1] == 0:
	print('NA')
elif J[0] == 0 and J[1] == 1:
	print('YYMM')
elif J[0] == 1 and J[1] == 0:
	print('MMYY')
else:
	print('AMBIGUOUS')

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

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


if first in monthlist and second in monthlist:
    print("AMBIGUOUS")
elif first in monthlist:
    print("MMYY")
elif second in monthlist:
    print("YYMM")
else:
    print("NA")

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

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

Solution (Python):
s = int(input())
a, b = s//100, s%100
p = bool(1 <= a <= 12)
q = bool(1 <= b <= 12)
if p & q:
    print("AMBIGUOUS")
elif p:
    print("MMYY")
elif q:
    print("YYMM")
else:
    print("NA")

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

Solution (Python):
s = list( map( int, input() ) )

n1 = s[0]*10 + s[1]
n2 = s[2]*10 + s[3]

if n1 > 0 and n1 <=12:
    if n2 > 0 and n2 <= 12:
        ans = 'AMBIGUOUS'
    else:
        ans = 'MMYY'
else:
    if n2 > 0 and n2 <= 12:
        ans = 'YYMM'
    else:
        ans = 'NA'

print(ans)

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

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

Solution (Python):
s = input()
first = int("".join(s[:2]))
last = int("".join(s[2:]))

if first > 0 and first <=12:
  if last > 0 and last <= 12:
    ans = 'AMBIGUOUS'
  else:
    ans = 'MMYY'
else:
  if last > 0 and last <= 12:
    ans = 'YYMM'
  else:
    ans = 'NA'
print(ans)

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

s = input().strip()

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

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

Solution (Python):
s=input()

def is_month(s):
  return 0 < int(s) < 13

s1_is_month = is_month(s[:2])
s2_is_month = is_month(s[2:])

if s1_is_month and s2_is_month:
  print('AMBIGUOUS')
elif s1_is_month:
  print('MMYY')
elif s2_is_month:
  print('YYMM')
else:
  print('NA')

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

def is_month(s):
  return 0 < int(s) < 13

s1_is_month = is_month(s1)
s2_is_month = is_month(s2)

if s1_is_month or s2_is_month:
  if s1_is_month and not s2_is_month:
    print('MMYY')
  elif not s1_is_month and s2_is_month:
    print('YYMM')
  else:
    print('AMBIGUOUS')
elif not is_month(s1) and not is_month(s2):
  print('NA')

Solution (Python):
import math
import copy

inputa = input().split()






a = inputa[0]
inputList = list(a)









tmptop = [inputList[0], inputList[1]]
tmpjointop = "".join(tmptop)
top = int(tmpjointop)

tmpbottom = [inputList[2], inputList[3]]
tmpjoinbottom = "".join(tmpbottom)
bottom = int(tmpjoinbottom)

flgFrontMM = True
flgTermMM = True

if top > 12 or top == 0:
    flgFrontMM = False

if bottom > 12 or bottom == 0:
    flgTermMM = False

if flgFrontMM and flgTermMM:
    print("AMBIGUOUS")
elif flgFrontMM == False and flgTermMM == False:
    print("NA")
elif flgFrontMM:
    print("MMYY")
elif flgTermMM:
    print("YYMM")

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

Solution (Python):
def ismonth(m):
    if 1 <= m and m <= 12:
        return True
    else:
        return False

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

if ismonth(S1):
    if ismonth(S2):
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if ismonth(S2):
        print('YYMM')
    else:
        print('NA')

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


month=["01","02","03","04","05","06","07","08","09","10","11","12"]
at=(a in month)
bt=(b in month)

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

Solution (Python):
A = [["NA", "YYMM"],
     ["MMYY", "AMBIGUOUS"]]
s = input()
a, b = map(int, [s[:2], s[2:]])
print(A[0 < a < 13][0 < b < 13])

Solution (Python):
A = [["NA", "YYMM"],
     ["MMYY", "AMBIGUOUS"]]
s = input()
a, b = map(int, [s[:2], s[2:]])
print(A[0 < a < 13][0 < b < 13])

Solution (Python):
S = input()
hantei1 = 0
hantei2 = 0

S1 = int(S[0] + S[1])
S2 = int(S[2] + S[3])

if S1 > 0 and S1 <13 :
    hantei1 = 1
if S2 > 0 and S2 <13 :
    hantei2 = 1

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

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

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

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

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

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

Solution (Python):
s = input()
s_first = int(s[:2])
s_second = int(s[2:]) 

if 1 <= s_first <= 12 and 1 <= s_second <= 12:
	print("AMBIGUOUS")
elif (not 1 <= s_first <= 12 ) and 1 <= s_second <= 12:
	print("YYMM")
elif 1 <= s_first <= 12 and (not 1 <= s_second <= 12):
	print("MMYY")
elif (not 1 <= s_first <= 12) and (not 1 <= s_second <= 12):
	print("NA")

Solution (Python):
s = list(input())
s_first = int("".join(s[:2])) 
s_second = int("".join(s[2:])) 

if 1 <= s_first <= 12 and 1 <= s_second <= 12:
	print("AMBIGUOUS")
elif (not 1 <= s_first <= 12 ) and 1 <= s_second <= 12:
	print("YYMM")
elif 1 <= s_first <= 12 and (not 1 <= s_second <= 12):
	print("MMYY")
elif (not 1 <= s_first <= 12) and (not 1 <= s_second <= 12):
	print("NA")

Solution (Python):
S = input()
S1 = int(S[0:2])
S2 = int(S[2:4])
YY = list(range(100))
MM = list(range(1,13))

if (S1 in YY and S1 not in MM) and S2 in MM:
  print("YYMM")
elif S1 in MM and (S2 in YY and S2 not in MM):
  print("MMYY")
elif S1 in MM and S2 in MM:
  print("AMBIGUOUS")
else:
  print("NA")

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

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

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

Solution (Python):
def solve():
    s = input()
    yy_or_mm = int(s[:2])
    mm_or_yy = int(s[2:])
    if is_month(yy_or_mm) and is_month(mm_or_yy):
        return "AMBIGUOUS"
    elif not is_month(yy_or_mm) and is_month(mm_or_yy):
        return "YYMM"
    elif is_month(yy_or_mm) and not is_month(mm_or_yy):
        return "MMYY"
    elif not is_month(yy_or_mm) and not is_month(mm_or_yy):
        return "NA"


def is_month(mm):
    return 1 <= mm <= 12


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

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

Solution (Python):
s = input().split()[0]


format_list = []

if 1 <= int(s[:2]) <= 12:
    format_list.append('MMYY')

if 1 <= int(s[2:]) <= 12:
    format_list.append('YYMM')

if not format_list:
    ans = 'NA'
elif len(format_list) > 1:
    ans = 'AMBIGUOUS'
else:
    ans = format_list[0]

print(ans)

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

s = list(input())

before = s[0] + s[1]

after = s[2] + s[3]

ret_b = is_month(before)
ret_a = is_month(after)

if ret_b == 1 and ret_a == 1:
    print("AMBIGUOUS")
elif ret_b == 1 and ret_a == -1:
    print("MMYY")
elif ret_b == -1 and ret_a == 1:
    print("YYMM")
else:
    print("NA")

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

xx__ = s//100
__xx = s%100

if xx__ > 0 and xx__ < 13:
    if __xx > 0 and __xx < 13:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if __xx > 0 and __xx < 13:
        print('YYMM')
    else:
        print('NA')

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

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

Solution (Python):


S = int(input())

A = S // 100
B = S - (A* 100)

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

Solution (Python):
S=str(input())
AA=int(S[0:2])
BB=int(S[2:])
if 1<=AA and AA<=12 and 1<=BB and BB<=12:
	print('AMBIGUOUS')
elif 1<=AA and AA<=12 and (BB==0 or 13<=BB and BB<=99):
	print('MMYY')
elif (AA==0 or 13<=AA and AA<=99) and 1<=BB and BB<=12:
	print('YYMM')
else:
	print('NA')

Solution (Python):
l=[i for i in str(input())]
A=int(''.join(l[:2]))
B=int(''.join(l[2:]))

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

Solution (Python):
s = list(input())
f = int(''.join(s[:2]))
r = int(''.join(s[2:]))
yymm = 0
mmyy = 0
if 0 <= f and f <= 99:
    if 1<=r and r<= 12:
        yymm = 1
if 1<=f and f<= 12:
    if 0 <= r and r <= 99:
        mmyy = 1
if mmyy == 1 and yymm == 1:
    print('AMBIGUOUS')
elif mmyy == 0 and yymm == 1:
    print('YYMM')
elif mmyy == 1 and yymm == 0:
    print('MMYY')
else:
    print('NA')

Solution (Python):
A=input()
S=[int(A[i:i+2]) for i in range(0,len(A),2)]
if 1<=S[0] and S[0]<=12:
    if 1<=S[1] and S[1]<=12:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if 1<=S[1] and S[1]<=12:
        print('YYMM')
    else:
        print('NA')

Solution (Python):
s = input()

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

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

Solution (Python):


S = input()


def valid_my(mon, day):
    m = int(mon)

    if m <= 0 or 13 <= m:
        return False
    return True

def valid_ym(year, mon):
    y = int(year)
    m = int(mon)

    if m <= 0 or 13 <= m:
        return False

    return True


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

my = valid_my(A, B)
ym = valid_ym(A, B)

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

Solution (Python):
S = input()
F = int(S) // 100
B = int(S) % 100
if (F <= 12 and F > 0) and (B <= 12 and B > 0):
  print("AMBIGUOUS")
elif F <= 12 and F > 0:
  print("MMYY")
elif B <= 12 and B > 0:
  print("YYMM")
else:
  print("NA")

Solution (Python):
def between12(m):
    if 0 < m <= 12:
        return True
    else:
        return False

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

if between12(left):
    if between12(right):
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
else:
    if between12(right):
        print('YYMM')
        exit()

print('NA')

Solution (Python):

def between12(m):
    if 0 < m <= 12:
        return True
    else:
        return False

S = input()
left = int(S[0] + S[1])
right = int(S[2] + S[3])

if between12(left):
    if between12(right):
        print('AMBIGUOUS')
        exit()
    else:
        print('MMYY')
        exit()
else:
    if between12(right):
        print('YYMM')
        exit()

print('NA')

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

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()
before = S[:2]
after = S[2:]
a = int(after)
b = int(before)

a_flg = False
b_flg = False
if 1 <= a and a <= 12:
  a_flg = True
if 1 <= b and b <= 12:
  b_flg = True

if b_flg and a_flg:
  print('AMBIGUOUS')
elif b_flg and not a_flg:
  print('MMYY')
elif not b_flg and a_flg:
  print('YYMM')
else:
  print('NA')

Solution (Python):
ym=input()
y=ym[:2]
m=ym[2:]
ys=[str(i).zfill(2) for i in range(100)]
ms=[str(i).zfill(2) for i in range(1,13)]
if (y in ys) and (m in ms) and (y in ms) and (m in ys):
    print('AMBIGUOUS')
elif y in ms and m in ys:
    print('MMYY')
elif y in ys and m in ms:
    print('YYMM')
else:
    print('NA')

Solution (Python):
S=list(input())
f=10*int(S[0])+ int(S[1])
l=10*int(S[2])+int(S[3])
if 1<=f<=12 and 1<=l<=12:
  print('AMBIGUOUS')
elif (f>=13 or f==0) and 1<=l<=12:
  print('YYMM')
elif 1<=f<=12 and (l>=13 or l==0):
  print('MMYY')
else:
  print('NA')

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