order lines by intersections