sort input files