from typing import List


def pares_impares(matriz: List[List[int]], s: str) -> List[int]:
    """
    >>> matriz = [ \
        [4, 5, 6, 3], \
        [1, 4, 6, 7], \
        [8, 2, 3, 6], \
        [3, 5, 4, 9], \
        [3, 4, 5, 3] \
    ]
    >>> pares_impares(matriz, 'par')
    [4, 6, 4, 6, 8, 2, 6, 4, 4]
    """
    if s == 'par':
        return [x for fila in matriz for x in fila if x % 2 == 0]
    elif s == 'impar':
        return [x for fila in matriz for x in fila if x % 2 != 0]
    else:
        return []