Sort incoming data