Minimum variance of binary matrix

I have a matrix of 0 and 1, example:

X = 
[[1, 1, 0, 0],
[1, 0, 1, 1],
[0, 0, 1, 1],
[1, 1, 1, 1],

In each row, choose only an ‘1’ and leave orthers become 0, to get the same number of ‘1’ in each colunm. Basically, minimum variance after get sum by columns. Example: From X above, the answer is:

Y = 
[[1, 0, 0, 0],
[0, 0, 0, 1],
[0, 0, 1, 0],
[0, 1, 0, 0],

Each column in Y have a ‘1’. How can i do that? Sorry for my bad english.