Lexograhical sort