output_description: If Snuke can create a matrix satisfying the condition, print `Yes`; otherwise,
  print `No`.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      H W
      a_{11}a_{12}...a_{1W}
      :
      a_{H1}a_{H2}...a_{HW}
attempt: import sys
  from collections import defaultdict, Counter
  
  read = sys.stdin.buffer.read
  readline = sys.stdin.buffer.readline
  
  in_n = lambda: int(readline())
  in_nn = lambda: map(int, readline().split())
  in_nl = lambda: list(map(int, readline().split()))
  in_na = lambda: map(int, read().split())
  in_s = lambda: readline().rstrip().decode("utf-8")
  
  
  def main():
      H, W = in_nn()
      a = []
      for i in range(H):
          a += list(in_s())
  
      mH = -(-H // 2)
      mW = -(-W // 2)
      nums = defaultdict(int)
      for y in range(mH):
          for x in range(mW):
              if x == W - x - 1 and y == H - y - 1:
                  n = 1
              elif x == W - x - 1:
                  n = 2
              elif y == H - y - 1:
                  n = 2
              else:
                  n = 4
              nums[n] += 1
  
      count = Counter(a)
      td = defaultdict(int)
      for v in count.values():
          for n in (4, 2, 1):
              if v >= n:
                  if td[n] < nums[n]:
                      c = min(v // n, nums[n] - td[n])
                      td[n] += c
                      v -= n * c
  
      # print(nums)
      # print(td)
  
      ans = "Yes"
      for n in (4, 2, 1):
          if td[n] != nums[n]:
              ans = "No"
              break
  
      print(ans)
  
  
  if __name__ == "__main__":
      main()
  
problem_description: Statement
  
  We have an H-by-W matrix. Let a_{ij} be the element at the i-th row from the
  top and j-th column from the left. In this matrix, each a_{ij} is a lowercase
  English letter.
  
  Snuke is creating another H-by-W matrix, A', by freely rearranging the
  elements in A. Here, he wants to satisfy the following condition:
  
    * Every row and column in A' can be read as a palindrome.
  
  Determine whether he can create a matrix satisfying the condition.
samples: [{"input": "3 4\n    aabb\n    aabb\n    aacc", "output": "Yes\n    \n\nFor example, the following matrix satisfies the condition.\n\n    \n    \n    abba\n    acca\n    abba\n    \n\n* * *"}, {"input": "2 2\n    aa\n    bb", "output": "No\n    \n\nIt is not possible to create a matrix satisfying the condition, no matter how\nwe rearrange the elements in A.\n\n* * *"}, {"input": "5 1\n    t\n    w\n    e\n    e\n    t", "output": "Yes\n    \n\nFor example, the following matrix satisfies the condition.\n\n    \n    \n    t\n    e\n    w\n    e\n    t\n    \n\n* * *"}, {"input": "2 5\n    abxba\n    abyba", "output": "No\n    \n\n* * *"}, {"input": "1 1\n    z", "output": "Yes"}]