from typing import List


def transpose(matrix: List[str]):
    """Transposes a matrix.
    """
    output: List[str] = ["" for _ in range(0, len(matrix))]

    for row in matrix:
        values = row.split()
        i = 0
        for val in values:
            output[i] = " ".join(filter(lambda x: len(x) > 0, [output[i], val]))
            i += 1

    return output