sumtrian and tsort