output_description: Print the K-th element.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      K
attempt: a = input()
  b = input()
  c = input()
  
  
  def common(s1, s2):
      l1 = len(s1)
      l2 = len(s2)
      memo = [[0 for i in range(l1 + 2)] for j in range(l2 + 2)]
  
      for idx1, w1 in enumerate(s1):
          for idx2, w2 in enumerate(s2):
              if w1 == w2 or w1 == "?" or w2 == "?":
                  memo[idx2 + 1][idx1 + 1] = memo[idx2][idx1] + 1
  
      return memo
  
  
  m1 = 0
  m2 = 0
  m3 = 0
  for l in common(a, b):
      if max(l) > m1:
          m1 = max(l)
  for l in common(a, c):
      if max(l) > m2:
          m2 = max(l)
  for l in common(b, c):
      if max(l) > m3:
          m3 = max(l)
  ans = len(a) + len(b) + len(c) - m1 - m2 - m3 + min([m1, m2, m3])
  
  print(ans)
  
problem_description: Statement
  
  Print the K-th element of the following sequence of length 32:
  
      
      
      1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51
samples: [{"input": "6", "output": "2\n    \n\nThe 6-th element is 2.\n\n* * *"}, {"input": "27", "output": "5\n    \n\nThe 27-th element is 5."}]