Sort junctions.