read each line, generate line lexicographically