NN = input()
AA = int(NN[0:2])
BB = int(NN[2:])

count1 = 0
count2 = 0
if AA > 12 or AA == 00:
  count1 +=1
if BB > 12 or BB == 00:
  count2 +=1
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA') NN = input() NN input() input AA = int(NN[0:2]) AA int(NN[0:2]) int NN[0:2] NN 0:2 0 2 BB = int(NN[2:]) BB int(NN[2:]) int NN[2:] NN 2: 2 count1 = 0 count1 0 count2 = 0 count2 0 if AA > 12 or AA == 00:
  count1 +=1 AA > 12 or AA == 00 AA > 12 AA 12 AA == 00 AA 00 count1 +=1 count1 1 if BB > 12 or BB == 00:
  count2 +=1 BB > 12 or BB == 00 BB > 12 BB 12 BB == 00 BB 00 count2 +=1 count2 1 if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA') count1 == 0 and count2 == 0 count1 == 0 count1 0 count2 == 0 count2 0 print('AMBIGUOUS') print 'AMBIGUOUS' elif count1 ==1 and count2 == 0:
  print('YYMM') count1 ==1 and count2 == 0 count1 ==1 count1 1 count2 == 0 count2 0 print('YYMM') print 'YYMM' elif count1 ==0 and count2 == 1:
  print('MMYY') count1 ==0 and count2 == 1 count1 ==0 count1 0 count2 == 1 count2 1 print('MMYY') print 'MMYY' print('NA') print 'NA' BB = int(NN[2:]) int(NN[2:]) BB count2 = 0 0 count2 count2 +=1 1 count2 count1 +=1 1 count1 NN = input() input() NN AA = int(NN[0:2]) int(NN[0:2]) AA count1 = 0 0 count1
NN = input()
AA = int(NN[0:2])
BB = int(NN[2:])

count1 = 0
count2 = 0
if AA > 12 or AA == 00:
  count1 +=1
if BB > 12 or BB == 00:
  count2 +=1
if count1 == 0 and count2 == 0:
  print('AMBIGUOUS')
elif count1 ==1 and count2 == 0:
  print('YYMM')
elif count1 ==0 and count2 == 1:
  print('MMYY')
else:
  print('NA')