Simultaneously sorting overlapping quantum states of light