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.



Sample input:
1905


Sample output:
YYMM

Submission status: Wrong Answer

Solution code:
S = input()

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

print(a, b)

isYYMM = 1 <= b <= 12
isMMYY = 1 <= a <= 12

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

Submission status: Wrong Answer

Solution code:
s = input()

s_list = [int(x) for x in list(s)]

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

form = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

def main():
    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 and A <= 12 and (0 == B or 12 < B):
        print("YYMM")

    elif 1 <= B and B <= 12 and (0 == A or 12 < A):
        print("MMYY")

    else:
        print("NA")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = input()

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

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

Submission status: Wrong Answer

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

if (int(a) > 12 and int(b) > 12) or  int(b) == 0  or int(a) == 0:
	
	print("NA")
	sys.exit()
	
if 0 <  int(a) <= 12 and 0 <  int(b) <= 12:
	print("AMBIGUOUS")

	
if int(a) > 12 and 0 < int(b) <= 12:

	print("YYMM")
	sys.exit()

if 0 < int(a) <= 12 and int(b) > 12:

	print("MMYY")
	sys.exit()

print("NA")

Submission status: Wrong Answer

Solution code:
s = input()

a = s[0:2]
b = s[2:4]

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

Submission status: Wrong Answer

Solution code:
S = input()
X = int(S[0:2])
Y = int(S[2:4])

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

Submission status: Wrong Answer

Solution code:
S=input()
A=int(S[:2])
B=int(S[2:])

YM=MY=False
if 0<B<=12:
    if A: YM=True
    else: MY=True
if 0<A<=12:
    if B: MY=True
    else: YM=True

if MY and YM: print("AMBIGUOUS")
elif MY: print("MMYY")
elif YM: print("YYMM")
else: print("NA")

Submission status: Wrong Answer

Solution code:
S = input()

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


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

Submission status: Wrong Answer

Solution code:
S = str(input())
li = [(i+j) for (i,j) in zip(S[::2],S[1::2])]
if int(li[0]) == 00 or int(li[1]) == 00:
    print('NA')
elif int(li[0]) <= 12 and int(li[1]) <= 12:
    print('AMBIGUOUS')
elif int(li[0]) >= 13 and int(li[1]) <= 12:
    print('YYMM')
elif int(li[0]) <= 12 and int(li[1]) >= 13:
    print('MMYY')

Submission status: Wrong Answer

Solution code:
s = input()

ab = int(s[:2])
cd = int(s[3:])

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

Submission status: Wrong Answer

Solution code:
import sys

input = sys.stdin.readline


def check_format(num):
    if not num:
        return 0
    if num <= 12:
        return 2
    return 1


def main():
    s = input()
    f = int(s[:2])
    b = int(s[2:])
    f_format = check_format(f)
    b_format = check_format(b)
    format_ = "AMBIGUOUS"
    if f_format == 0 or b_format == 0:
        format_ = "NA"
    if f_format == 1 and b_format == 2:
        format_ = "YYMM"
    if f_format == 2 and b_format == 1:
        format_ = "MMYY"
    print(format_)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
S = int(input())
a = S // 100
b = S % 100

ans = ""

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

print(ans)

Submission status: Wrong Answer

Solution code:
s =input()
li = [(i+j) for (i,j) in zip(s[::2],s[1::2])]

if (int(li[0])>12)&(int(li[0])>0):
  if (int(li[1])>12)|(int(li[1])==0):
  	print('NA')
  else:
    print('YYMM')
elif int(li[0])==0:
  if int(li[1])==0:
    print('NA')
  else:
    print('YYMM')
else:
  if int(li[1])>12:
    print('MMYY')
  else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
s = input()

s_list = [int(x) for x in list(s)]

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

form = ['YYMM', 'MMYY', 'AMBIGUOUS', 'NA']

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

Submission status: Wrong Answer

Solution code:
import sys

S = input()

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

if S[0:2] == '00' or S[2:4] == '00':
    if 0 < A <= 12:
        print('MMYY')

    elif 0 < B <= 12:
        print('YYMM')
    else:
        print('NA')

else:
    if 12 < A and 12 < B:
        print('NA2')

    if  0 <= B and B <= 12:
        if  0 <= A and A <= 12:
            print('AMBIGUOUS')
        else:
            print('YYMM')

    elif 0 <= A and A <= 12:
        print('MMYY')

Submission status: Wrong Answer

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

if S1 == 0 and S2 == 0:
    print('NA')
elif S1 == 0 and S2 >12:
    print('NA')
elif S1 > 12 and S2 == 0:
    print('NA')
elif S1 > 12 and S2 > 12:
    print('NA')
elif S1 > 12 and S2 <= 12:
    print('YYMM')
elif S1 <= 12 and S2 > 12:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
S = input()

mm = int(S[3:])
if mm == 0 or mm > 12:
    yymm = False
else:
    yymm = True

mm = int(S[:2])
if mm == 0 or mm > 12:
    mmyy = False
else:
    mmyy = True

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

Submission status: Wrong Answer

Solution code:
s = list(input())
bef=int(s[0])*10+int(s[1])
aft=int(s[2])*10+int(s[3])

ans=''
if 0<aft<13 and 0<bef<13:
  ans='AMBIGUOUS'
elif 100>aft>=0 and 0<bef<32:
  ans='MMYY'
elif 100>bef>=0 and 0<aft<32:
  ans='YYMM'
else:
  ans='NA'
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
a = int(n[0])*10 + int(n[1])
b = int(n[2])*10 + int(n[3])

s = 0
t = 0

if a > 12 or a == 0:
  s = 1
elif b > 12 or b == 0:
  t = 1

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

Submission status: Wrong Answer

Solution code:
import sys


def main():
    S = sys.stdin.readline().rstrip()

    s1, s2 = int(S[:2]), int(S[2:])
    if (s1 < 1 or s2 < 1) and (s1 > 13 or s2 > 13):
        print("NA")

    elif s1 > 13 and s2 < 13:
        print("YYMM")
    elif s1 < 13 and s2 > 13:
        print("MMYY")
    else:
        print("AMBIGUOUS")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import random

s = input()

# s = f"{random.randint(0,100)} {random.randint(0,100)}"
s1 = int(s[:2])
s2 = int(s[2:])

# print(s1,s2)
if len(s) != 4:
    print("NA")

if (s1 == 0) or (s2 == 0):
    print("NA")
elif (s1 > 12) and (s2 > 12):
    print("NA")
elif s2 > 12:
    print("MMYY")
elif s1 > 12:
    print("YYMM")
else:
    print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
S=int(input())
a=S//100
b=S%100
if 0<a<13 and 0<b<13:
    print('AMBIGUOUS')
elif 0<a<13 and 12<b<100:
    print("MMYY")
elif 12<a<100 and 0<b<13:
    print("YYMM")
elif 0<a<13 and b==0:
    print('MMYY')
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
s = input()
sl = list(map(int, [s[0:2],s[2:]]))
f,l = sl[0], sl[1]
if (f ==0 and (l ==0 or l >12)) or (l ==0 and (f==0 or f>12)) :
    print('NA')
elif (f>12 and l<13) or f==0:
    print('YYMM')
elif (f<13 and l>12) or l==0:
    print('MMYY')
elif  f < 13 and l <13:
    print('AMBIGOOUS')
else :
    print('NA')

Submission status: Wrong Answer

Solution code:
S = list(input())
S1 = int("".join(S[0:2]))
S2 = int("".join(S[2:4]))
 
if (12 >= S1 and S1 >= 1) and (12 >= S2 and S2 >= 1):
  print('AMBIGUOUS')
elif (S1 == 0) or (S2 == 0):
  print('NA')
elif (12 >= S1 and S1 >= 1):
  print('MMYY')
elif (12 >= S2 and S2 >= 1):
  print('YYMM')
else :
  print('NA')

Submission status: Wrong Answer

Solution code:
S=list(input())
BE=[int(S[0]),int(S[1])]
AF=[int(S[2]),int(S[3])]
b_flag=0
a_flag=0
if BE[0] == 0:
    b_flag=1
if BE[0] == 1 and BE[1] <=2:
    b_flag=1
if AF[0] == 0:
    a_flag=1
if AF[0] == 1 and AF[1] <=2:
    a_flag=1
if a_flag ==1 and b_flag==1:
    print('AMBIGUOUS')
elif a_flag ==1:
    print('YYMM')
elif b_flag==1:
    print('MMYY')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
S = str(input())
S_list = list(S)


S12 = int(S_list[0]+S_list[1])
S34 = int(S_list[2]+S_list[3])

flagYYMM = 0
flagMMYY = 0

if S12 == 00 or S34 == 00:
    print("NA")
    exit()

if S34 <= 12 and S34 <= 31:
    flagYYMM = 1

if S12 <= 12 and S12 <= 31:
    flagMMYY = 1

if flagYYMM == 1 and flagMMYY == 1:
    print("AMBIGUOUS")

elif flagYYMM == 1:
    print("YYMM")

elif flagMMYY == 1:
    print("MMYY")

else:
    print("NA")

Submission status: Wrong Answer

Solution code:
S=input()

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

YYMM=True
MMYY=True
AMBIGUOUS=True
NA=True


if left<=0 or left>12:
  MMYY=False
  AMBIGUOUS=False
else:
  NA=False
  
if right<=0 or right>12:
  YYMM=False
  AMBIGUOUS=False
else:
  NA=False

if YYMM==True:
  if MMYY==True:
    print("AMBIGOUS")
  else:
    print("YYMM")
else:
  if MMYY==True:
    print("MMYY")
  else:
    print("NA")

Submission status: Wrong Answer

Solution code:
N = int(input())

first = int(N/100)
second = N - first*100

f_YY = False
s_YY = False
f_MM = False
s_MM = False

if 0 <= first and first <= 99:
    f_YY = True
if 0 <= second and second <= 99:
    s_YY = True
if 1 <= first and first <= 12:
    f_MM = True
if 1 <= second and second <= 12:
    s_MM = True
    
if (f_YY == True and s_MM == True) and\
    (f_MM == True and s_YY == True):
    print('AMBIGUOUS')
elif f_YY == True and s_MM == True:
    print('YYMM')
elif f_MM == True and s_YY == True:
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

if (int(a) > 12 and int(b) > 12) or  int(b) == 0  or int(a) == 0:
	
	print("NA")
	sys.exit()
	
if int(a) <= 12 and int(b) <= 12:
	print("AMBIGUOUS")

	
if 32 > int(a) > 12 and int(b) <= 12:

	print("YYMM")
	sys.exit()

if int(a) <= 12 and 32 > int(b) > 12:

	print("MMYY")
	sys.exit()
print("NA")

Submission status: Wrong Answer

Solution code:
S = input()
mae, usiro = int("".join(S[:2])), int("".join(S[2:]))
if 1 <= mae <= 12 and 1 <= usiro <= 12:
    print("AMBIGUOUS")
elif 1 <= mae<= 12 and usiro != 0:
    print("MMYY")
elif mae != 0 and 1 <= usiro <= 12:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
S=input()
mm=['01','02','03','04','05','06','07','08','09','10','11','12']
yy=['00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19']
 
if S[0:2] in mm:
    if S[2:4] in mm:
        print('AMBIGUOUS')
    elif S[2:4] in yy:
        print('MMYY')
    else:
        print('NA')
elif S[0:2] in yy:
    if S[2:4] in mm:
        print('YYMM')
    else:
        print('NA')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
s=input()
former,latter=int(s[:2]),int(s[2:])

#0,13<=x<=99で年だけ　1<=x<=12で年か月,　ほかはどっちか
def decide(x):
    if x==0 or 13<=x<=99:
        return 0  #年だけ
    elif 1<=x<=12:
        return 1  #どっちもある
f=decide(former)
l=decide(latter)
print(f,l)
if f==0 and l==1:
    print('YYMM')
elif f==1 and l==0:
    print('MMYY')
elif f==0 and l==0:
    print('NA')
else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
zen, kou = int(S[:2]), int(S[2:])
if 13 <= zen <= 99 and 1 <= kou <= 12:
    print('YYMM')
if zen == 0 and 1 <= kou <= 12:
    print('YYMM')
elif 1 <= zen <= 12 and 13 <= kou <= 99:
    print('MMYY')
elif 1 <= zen <= 12 and kou == 0:
    print('MMYY')
elif 1 <= zen <= 12 and 1 <= kou <= 12:
    print('AMBIGUOUS')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
a = list(input()) 
for i in range(len(a)):
    a[i] = int(a[i])
ue = a[0]*10 + a[1]
sita = a[2]*10 + a[3]
if (ue > 12) & (sita > 12):
    print('NA')
elif (ue <= 12) & (sita <= 12):
    if (sita == 0) & (ue == 0):
        print('NA')
    else:
        print('AMBIGUOUS')
elif ue > 12:
    if (sita <= 12) & (sita > 0):
        print('YYMM')
    else:
        print('NA')
elif sita > 12:
    if (ue <= 12) & (ue > 0):
        print('MMYY')
    else:
        print('NA')

Submission status: Wrong Answer

Solution code:
s_format = input()

first2 = int(s_format[0]+s_format[1])

last2 = int(s_format[2]+s_format[3])

#print(first2, last2)


if 0 < first2 < 13 and 0 < last2 < 13:
    print("AMBIGUOUS")
elif 0 < first2 < 13 and last2 > 0:
    print("MMYY")
elif first2 > 0 and 0 < last2 < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
S = int(input())
A = S//100
B = S-(A*100)
if B >12:
    if  1<= A <=12:    
        print("MMYY")
    elif A >= 13:
        print("NA")
    else:
        print("NA")
elif 1<= B <=12:
    if 1<= A <=12:
        print("AMBIGUOUS")
    elif A >= 13:
        print("YYMM")
    else:
        print("NA")
else :
    print("NA")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n = str(input())
b = n[:2]
a = n[2:]
be = int(b)
af = int(a)
if 13<=be<=99 and 1<=af<=12:
    print("YYMM")
elif 1<=be<=12 and 13<=af<=99:
    print("MMYY")
elif 1<=be<=12 and 1<=af<=12:
    print("AMBIGUOUS")
elif be==0 and 1<=af<=12:
    print("YYMM")
elif 1<=af<=12 and be==0:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


# N = int(input())
# A = [int(x) for x in input().split()]
# a, b, c = map(int, input().split())
# name1 = str(input())
# alph = {"A": 1, "B": 2, "C": 3, "D": 4, "E": 5}
# b = list(map(lambda x: math.ceil(x/10)*10, a))

s = int(input())
YY = s // 100
MM = s % 100
print(YY, MM)
if 1 <= YY <= 12 and 1 <= MM <= 12:
    print("AMBIGUOUS")
elif 0 < MM <= 12:
    print("YYMM")
elif 0 < YY <= 12:
    print("MMYY")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
#coding: utf-8
S = input()
year = 19
month = 12
mae, ushiro = int(S[:2]), int(S[2:])
if 0 < mae <= month and 0 < ushiro <= month:
	print("AMBIGUOUS")
elif 0 < mae <= month and 0 <= ushiro <= year:
	print("MMYY")
elif 0 <= mae <= year and 0 < ushiro <= month:
	print("YYMM")
else:
	print("NA")

Submission status: Wrong Answer

Solution code:
def check(S) :
    mae = int(S[:2])
    ato = int(S[2:])
    if mae == 0 :
        return "NA"
    if ato == 0 :
        return "NA"
    if mae > 12 and ato > 12 :
        return "NA"
    if mae <= 12 and ato <= 12 :
        return "AMBIGUOUS"
    
    if mae <= 12 :
        return "MMYY"
    if mae > 12 :
        return "YYMM"
    if ato <= 12 :
        return "YYMM"
    if ato > 12:
        return "MMYY"


S = input()
print(check(S))

Submission status: Wrong Answer

Solution code:
import sys


def main():
    S = sys.stdin.readline().rstrip()

    s1, s2 = int(S[:2]), int(S[2:])
    if s1 < 1 or s2 < 1:
        print("NA")

    elif s1 > 13 and s2 <= 13:
        print("YYMM")
    elif s1 <= 13 and s2 > 13:
        print("MMYY")
    else:
        print("AMBIGUOUS")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N = int(input())

first = int(N/100)
second = N - first*100

f_YY = False
s_YY = False
f_MM = False
s_MM = False

if 0 <= first and first <= 99:
    f_YY = True
if 0 <= second and second <= 99:
    s_YY = True
if 1 <= first and first <= 12:
    f_MM = True
if 1 <= second and second <= 12:
    s_MM = True
    
if (f_YY == True and s_MM == True) and\
    (f_MM == True and s_YY == True):
    print('AMBIGUOUS')
elif f_YY == True and s_MM == True:
    print('YYMM')
elif f_MM == True and s_YY == True:
    print('YYMM')
elif (f_YY == False or s_MM == False) and\
    (f_MM == False or s_YY == False):
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
a=int(input())
y=a//100
m=a%100
if m==0 or y==0:
    print("NA")
elif y<13 and m<13:
    print("AMBIGUOUS")
elif y<13 and m>12:
    print("MMYY")
elif y>12 and m<13:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect, math
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]

def solve():
    ans = ''
    u = N // 100
    l = N % 100
    if u == 0 or l == 0:
        return 'NA'
    if u > 12 and l < 13:
        ans = 'YYMM'
    elif u < 13 and l > 12:
        ans = 'MMYY'
    elif u < 13 and l < 13:
        ans = 'AMBIGUOUS'
    else:
        ans = 'NA'
    return ans

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

Submission status: Wrong Answer

Solution code:
ans = ''
fmt = input()
n1 = int(fmt[:2])
n2 = int(fmt[2:])

if n1 == 0 or n2  == 0:
    ans = 'NA'
elif n1 > 12 and n2 > 12:
    ans = 'NA'
elif n1 <= 12 and n2 <= 12:
    ans = 'AMBIGUOUS'
elif n1 > 12:
    ans = 'YYMM'
else:
    ans = 'MMYY'
print(ans)

Submission status: Wrong Answer

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

if S1 == 0 and S2 == 0:
    print('NA')
if S1 == 0 and S2 >12:
    print('NA')
if S1 > 12 and S2 == 0:
    print('NA')
elif S1 > 12 and S2 > 12:
    print('NA')
elif S1 > 12 and S2 <= 12:
    print('YYMM')
elif S1 <= 12 and S2 > 12:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
import re 
S=input()
def YM(S):
  if re.match("(1[3-9]|[2-9][0-9])(0[1-9]|1[0-2])",S):
    return "YYMM"
  elif re.match("(0[1-9]|1[0-2])(1[3-9]|[2-9][0-9])",S):
    return "MMYY"
  else:
    return "AMBIGUOUS"
print("{}".format(YM(S)))

Submission status: Wrong Answer

Solution code:
n = str(input())

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

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

Submission status: Wrong Answer

Solution code:
s = list(input())
m = ['{:02}'.format(n) for n in range(1,13)]
f = ''.join(s[:2])
b = ''.join(s[2:])

if f == '00':
    if b in m:
        print('YYMM')
    else:
        print('NA')
elif b == '00':
    if f in m:
        print('MMYY')
    else:
        print('NA')
elif f in m and b in m:
    print('AMBIGUOUS')
elif f in m and b not in m:
    print('MMYY')
elif f not in m and b in m:
    print('YYMM')

Submission status: Wrong Answer

Solution code:
s=[int(i) for i in list(input())]

if (s[0]==0 or (s[0]==1 and (s[1]==0 or s[1]==1 or s[1]==2))) and (s[2]==0 or (s[2]==1 and (s[3]==0 or s[3]==1 or s[3]==2))):
    print('ANBIGUOUS')
elif (s[0]==0 and s[1]==0) or (s[2]==0 and s[3]==0):
    print('NA')
elif s[0]==0:
    print('MMYY')
elif s[0]==1 and (s[1]==0 or s[1]==1 or s[1]==2):
    print('MMYY')
elif s[2]==0:
    print('YYMM')
elif s[2]==1 and (s[3]==0 or s[3]==1 or s[3]==2):
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
s = str(input())
s_a = s[:2]
s_b = s[2:]
def cale(t):
  result_list = []
  if int(t) > 0 and int(t) < 13:
    result_list.append('MM')
  elif int(t) > 0 and int(t) <100:
    result_list.append('YY')
  else:
    result_list.append('NA')
  return result_list
 
s_a_re = cale(s_a)
s_b_re = cale(s_b)
 
if s_a_re[0] in 'NA' or s_b_re[0] in 'NA':
  print('NA')
elif s_a_re[0] == s_b_re[0] and s_a_re[0] == 'MM':
  print('AMBIGUOUS')
elif s_a_re[0] == s_b_re[0] and s_a_re[0] == 'YY':
  print('NA')
else:
  aws = s_a_re[0] + s_b_re[0]
  print(aws)

Submission status: Wrong Answer

Solution code:
S=input()
A=int(S[:2])
B=int(S[2:])

YM=MY=False
if A and 0<B<=12: YM=True
if 0<A<=12 and B: MY=True
if A==0 and 0<B<=12: YM=True

if MY and YM: print("AMBIGUOUS")
elif MY: print("MMYY")
elif YM: print("YYMM")
else: print("NA")

Submission status: Wrong Answer

Solution code:
N = int(input())

first = int(N/100)
second = N - first*100

f_YY = False
s_YY = False
f_MM = False
s_MM = False

if 0 <= first and first <= 99:
    f_YY = True
if 0 <= second and second <= 99:
    s_YY = True
if 1 <= first and first <= 12:
    f_MM = True
if 1 <= second and second <= 12:
    s_MM = True
    
if (f_YY == True and s_MM == True) and\
    (f_MM == True and s_YY == True):
    print('AMBIGUOUS')
elif f_YY == True and s_MM == True:
    print('YYMM')
elif f_MM == True and s_YY == True:
    print('YYMM')
elif (f_YY == False and s_MM == False) and\
    (f_MM == False and s_YY == False):
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
n = int(input())
a = n//100
b = n%100
if 0<a<=12 and 0<b<=12:
    print('AMBIGUOUS')
elif 1<=a<=12 and b>=13:
    print('MMYY')
elif 1<=b<=12 and 13<=a:
    print('YYMM')
else:
    print('NA')

Submission status: Wrong Answer

Solution code:
a=input()
i=0
n=[]
while i<len(a):
  n.append(a[i])
  i+=1
pd=n[0]+n[1]
sd=n[2]+n[3]
pd=int(pd)
sd=int(sd)
if pd>12:
  if sd>=1 and sd<=12:
    print('YYMM')
  elif sd>12:
    print('NA')
  elif sd<1:
    print('NA')
elif pd==0:
  if sd>12:
    print('NA')
  if sd>0 and sd<=12:
    print('YYMM')
elif pd<=12:
  if sd>12:
    print ('MMYY')
  elif sd==0:
    print('MMYY')
  elif sd<=12 and sd!=0:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
S = input()

YY = int(S[0]) * 10 + int(S[1])
MM = int(S[2]) * 10 + int(S[3])

if YY == 0 or MM == 0:
  print("NA")
  exit(0)
elif YY >= 13 and MM >=13:
  print("NA")
  exit(0)

if MM > 12:
  print("YYMM")
elif YY > 12:
  print("MMYY")
else:
  print("AMBIGUOUS")

Submission status: Wrong Answer

Solution code:
s_format = input()

first2 = int(s_format[0]+s_format[1])

last2 = int(s_format[2]+s_format[3])

#print(first2, last2)


if 0 < first2 < 13 and 0 < last2 < 13:
    print("AMBIGUOUS")
elif 0 < first2 < 13 and last2 > 12:
    print("MMYY")
elif first2 > 12 and 0 < last2 < 13:
    print("YYMM")
else:
    print("NA")

Submission status: Wrong Answer

Solution code:
import sys

s = input()
s = s[:4]
a = s[:2]
b = s[2:]

if (int(a) > 12 and int(b) > 12) or  int(b) == 0  or int(a) == 0:
	
	print("NA")
	sys.exit()
	
if int(a) <= 12 and int(b) <= 12:
	print("AMBIGUOUS")

	
if int(a) > 12 and int(b) <= 12:

	print("YYMM")
	sys.exit()

if int(a) <= 12 and int(b) > 12:

	print("MMYY")
	sys.exit()

Submission status: Wrong Answer

Solution code:
S = int(input())
A = S//100
B = S-(A*100)
if B >12:
    if  1<= A <=12:    
        print("YYMM")
    elif A >= 13:
        print("NA")
    else:
        print("NA")
elif 1<= B <=12:
    if 1<= A <=12:
        print("AMBIGUOUS")
    elif A >= 13:
        print("YYMM")
    else:
        print("NA")
else :
    print("NA")

Submission status: Wrong Answer

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

if S1 == 0 and S2 == 0:
    print('NA')
if S1 == 0 and S2 >13:
    print('NA')
if S1 > 13 and S2 == 0:
    print('NA')
elif S1 > 12 and S2 > 12:
    print('NA')
elif S1 > 12 and S2 <= 12:
    print('YYMM')
elif S1 <= 12 and S2 > 12:
    print('MMYY')
else:
    print('AMBIGUOUS')

Submission status: Wrong Answer

Solution code:
S = input()

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



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

Submission status: Wrong Answer

Solution code:
s = input();
first = s[0:2]
second = s[2:4]

first = int(first)
second = int(second)

if first == 0 or second == 0:
    print("NA")

elif first < 13:
    if second < 13:
        print("AMBIGUOUS")
    else:
        print("MMYY")

else:
    if second < 13:
        print("YYMM")
    else:
        print("NA")

Submission status: Wrong Answer

Solution code:
a = input()
b = int(a[:2])
c = int(a[2:])

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

Submission status: Wrong Answer

Solution code:
S = str(input())

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

if a == 0:
	if b == 0 or b > 12:
		ans = 'NA'
	elif 1 <= b <= 12:
		ans = 'YYMM'
elif 1 <= a <= 12:
	if b == 0 or b > 12:
		ans = 'MMYY'
	elif 1 <= b <= 12:
		ans = 'AMBIGUOUS'
elif a > 12:
	if b == 0 or b > 12:
		ans = 'NA'
	if 1 <= b <= 12:
		ans = 'YYMM'

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

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

Submission status: Wrong Answer

Solution code:
import sys


def main():
    S = sys.stdin.readline().rstrip()

    s1, s2 = int(S[:2]), int(S[2:])
    if s1 < 1 or s2 < 1:
        print("NA")

    elif s1 > 13 and s2 < 13:
        print("YYMM")
    elif s1 < 13 and s2 > 13:
        print("MMYY")
    else:
        print("AMBIGUOUS")


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#coding: utf-8
S = input()
year = 99
month = 12
mae = int(S[2:])
ushiro = int(S[2:])
if 0 < mae <= month and 0 < ushiro <= month:
    print("AMBIGUOUS")
elif 0 < mae <= month and 0 < ushiro <= year:
	print("MMYY")
elif 0 < mae <= year and 0 < ushiro <= month:
	print("YYMM")
else:
	print("NA")

Submission status: Wrong Answer

Solution code:
s = input()
if ((int(s[2]) == 1 and int(s[3]) <= 2) or (int(s[2]) == 0 and int(s[3] != 0))) and((int(s[0]) == 1 and int(s[1]) <= 2) or (int(s[0]) == 0 and int(s[1]) != 0)):
    print("AMBIGUOUS")
elif (int(s[0]) == int(s[1]) == int(s[2]) == int(s[3]) == 0) or (int(s[0]) >= 1 and int(s[1])>=3 and int(s[2])>=1 and int(s[3])>=3) or (int(s[0])==int(s[1])==0 and int(s[2])>=1 and int(s[3])>=3) or (int(s[2])==int(s[3])==0 and int(s[0]) >= 1 and int(s[1])>=3):
    print("NA")
elif (int(s[2]) == 1 and int(s[3]) <= 2) or (int(s[2]) == 0 and int(s[3] != 0)):
    print("YYMM")
elif (int(s[0]) == 1 and int(s[1]) <= 2) or (int(s[0]) == 0 and int(s[1]) != 0):
    print("MMYY")

Submission status: Wrong Answer

Solution code:
S=input()
mozi_1=int(S[0:2])
mozi_2=int(S[2:4])
if 00<mozi_1<13 and 00<mozi_2<13:print("AMBIGUOUS")
elif 0<mozi_1<13 and 12<mozi_2<100:print("MMYY")
elif 0<mozi_2<13 and 12<mozi_1<100:print("YYMM")
else:print("NA")

#print(mozi_1)
#print(mozi_2)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
S = input()
if ((S[:2] == "00") and (S[2:4]) == "00"):
  print("{}".format("NA"))
elif (S[:2] == "00") and (int(S[2:4]) < 13):
  print("{}".format("YYMM"))
elif(int(S[:2]) < 13) and (S[2:4] == "00"):
  print("{}".format("MMYY"))
elif ((S[0] == "0") and (S[3] == "0")):
  print("{}".format("AMBIGUOUS"))
elif ((int(S[:2]) < 13) and (int(S[2:4]))):
  print("{}".format("AMBIGUOUS"))
elif(int(S[0]) == 0):
     print("{}".format("MMYY"))
elif(int(S[2]) == 0):
     print("{}".format("YYMM"))
elif((int(S[:2]) > 12) and (int(S[2:4]) > 12)):
  print("{}".format("NA"))

Submission status: Wrong Answer

Solution code:
def isY(num):
    if num == 0 or num > 19:
        return False
    
    return True

def isM(num):
    if num <= 12 and num >= 1:
        return True

    return False


line = input()
first = int(line[:2])
second = int(line[2:])

ans = "NA"

if isY(first) and isM(second):
    ans = "YYMM"

if isM(first) and isY(second):
    if ans == "YYMM":
        ans = "AMBIGUOUS"
    else:
        ans = "MMYY"
        
print(ans)

Submission status: Wrong Answer

Solution code:
import re 
S=input()
def YM(S):
  if re.match("(1[3-9]|[2-9][0-9])(0[1-9]|1[0-2])",S):
    print("YYMM")
  elif re.match("(0[1-9]|1[0-2])(1[3-9]|[2-9][0-9])",S):
    print("MMYY")
  else:
    print("AMBIGUOUS")

print("{}".format(YM(S)))

Submission status: Wrong Answer

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