Use temporary files while sorting and merge-sort.