from collections import Counter





def solve():

    YES, NO = "Yes", "No"

    if H % 2 and W % 2:

        if rems[1] == 0 and rems[3] == 1:

            rems[1] += 1

            rems[2] += 1

            rems[3] = 0

        if rems[1] != 1 or rems[3] or rems[2] > H // 2 + W // 2:

            return NO

        else:

            return YES

    elif H % 2 or W % 2:

        even_edge = H if W % 2 else W

        if rems[1] + rems[3] or rems[2] > even_edge // 2:

            return NO

        else:

            return YES

    else:

        if rems[1] + rems[2] + rems[3]:

            return NO

        else:

            return YES





H, W = list(map(int, input().split()))

c = Counter()

for _ in range(H):

    c += Counter(eval(input()))

rems = Counter(v % 4 for v in list(c.values()))

print((solve()))

from collections import Counter



H, W = map(int, input().split())

cntr = Counter()

[cntr.update(Counter(input())) for _ in range(H)]



if H % 2 and W % 2:

    has_one = False

    twos = 0

    for v in cntr.values():

        if v % 2:

            if has_one:

                print("No")

                exit()

            else:

                has_one = True

                twos += 2 if v == 3 else 0

        else:

            twos += v % 4

    print("Yes") if twos // 2 <= H // 2 + W // 2 and has_one else print("No")

elif H % 2 or W % 2:

    if H % 2:

        H, W = W, H

    twos = 0

    for v in cntr.values():

        if v % 2:

            print("No")

            exit()

        else:

            twos += v % 4

    print("Yes") if twos <= H else print("No")

else:

    print("Yes") if all(v % 4 == 0 for v in cntr.values()) else print("No")

from collections import Counter


def solve():
    YES, NO = "Yes", "No"
    if H % 2 and W % 2:
        if rems[1] == 0 and rems[3] == 1:
            rems[1] += 1
            rems[2] += 1
            rems[3] = 0
        if rems[1] != 1 or rems[3] or rems[2] > H // 2 + W // 2:
            return NO
        else:
            return YES
    elif H % 2 or W % 2:
        even_edge = H if W % 2 else W
        if rems[1] + rems[3] or rems[2] > even_edge // 2:
            return NO
        else:
            return YES
    else:
        if rems[1] + rems[2] + rems[3]:
            return NO
        else:
            return YES


H, W = list(map(int, input().split()))
c = Counter()
for _ in range(H):
    c += Counter(eval(input()))
rems = Counter(v % 4 for v in list(c.values()))
print((solve()))

from collections import Counter

H, W = map(int, input().split())
cntr = Counter()
[cntr.update(Counter(input())) for _ in range(H)]
if H % 2 and W % 2:
    has_one = False
    twos = 0
    for v in cntr.values():
        if v % 2:
            if has_one:
                print("No")
                exit()
            else:
                has_one = True
                twos += 2 if v == 3 else 0
        else:
            twos += v % 4
    print("Yes") if twos // 2 <= H // 2 + W // 2 and has_one else print("No")
elif H % 2 or W % 2:
    if H % 2:
        H, W = W, H
    twos = 0
    for v in cntr.values():
        if v % 2:
            print("No")
            exit()
        else:
            twos += v % 4
    print("Yes") if twos <= H else print("No")
else:
    print("Yes") if all(v % 4 == 0 for v in cntr.values()) else print("No")

- -def solve(): -    YES, NO = "Yes", "No" -    if H % 2 and W % 2: -        if rems[1] == 0 and rems[3] == 1: -            rems[1] += 1 -            rems[2] += 1 -            rems[3] = 0 -        if rems[1] != 1 or rems[3] or rems[2] > H // 2 + W // 2: -            return NO +H, W = map(int, input().split()) +cntr = Counter() +[cntr.update(Counter(input())) for _ in range(H)] +if H % 2 and W % 2: +    has_one = False +    twos = 0 +    for v in cntr.values(): +        if v % 2: +            if has_one: +                print("No") +                exit() +            else: +                has_one = True +                twos += 2 if v == 3 else 0 -            return YES -    elif H % 2 or W % 2: -        even_edge = H if W % 2 else W -        if rems[1] + rems[3] or rems[2] > even_edge // 2: -            return NO +            twos += v % 4 +    print("Yes") if twos // 2 <= H // 2 + W // 2 and has_one else print("No") +elif H % 2 or W % 2: +    if H % 2: +        H, W = W, H +    twos = 0 +    for v in cntr.values(): +        if v % 2: +            print("No") +            exit() -            return YES -    else: -        if rems[1] + rems[2] + rems[3]: -            return NO -        else: -            return YES - - -H, W = list(map(int, input().split())) -c = Counter() -for _ in range(H): -    c += Counter(eval(input())) -rems = Counter(v % 4 for v in list(c.values())) -print((solve())) +            twos += v % 4 +    print("Yes") if twos <= H else print("No") +else: +    print("Yes") if all(v % 4 == 0 for v in cntr.values()) else print("No")