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 bisect
  import copy
  import heapq
  import math
  import sys
  from collections import *
  from functools import lru_cache
  from itertools import accumulate, combinations, permutations, product
  
  
  def input():
      return sys.stdin.readline()[:-1]
  
  
  def ruiseki(lst):
      return [0] + list(accumulate(lst))
  
  
  sys.setrecursionlimit(500000)
  mod = pow(10, 9) + 7
  al = [chr(ord("a") + i) for i in range(26)]
  direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]
  
  h, w = map(int, input().split())
  a = [input() for i in range(h)]
  
  lst = [0] * 26
  for i in range(h):
      for j in range(w):
          lst[ord(a[i][j]) - ord("a")] -= 1
  
  print(lst)
  
  heapq.heapify(lst)
  dic = defaultdict(int)
  if h % 2 == 0:
      if w % 2 == 0:
          dic[4] = h * w // 4
      else:
          dic[4] = (w - 1) * h // 4
          dic[2] = h // 2
  else:
      if w % 2 == 0:
          dic[4] = (h - 1) * w // 4
          dic[2] = w // 2
      else:
          dic[4] = (h - 1) * (w - 1)
          dic[2] = h // 2 + w // 2
          dic[1] = 1
  # print(dic)
  # print(lst)
  for i in range(dic[4]):
      tmp = -heapq.heappop(lst)
      if tmp >= 4:
          tmp -= 4
          heapq.heappush(lst, -tmp)
      else:
          print("No")
          quit()
  
  for i in range(dic[2]):
      tmp = -heapq.heappop(lst)
      if tmp >= 2:
          tmp -= 2
          heapq.heappush(lst, -tmp)
      else:
          print("No")
          quit()
  for i in range(dic[1]):
      tmp = -heapq.heappop(lst)
      if tmp >= 1:
          tmp -= 1
          heapq.heappush(lst, -tmp)
      else:
          print("No")
          quit()
  # print(lst)
  print("Yes")
  
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"}]