There are three coplanar parallel lines. If any $p$ points are taken on each of the lines, then find the maximum number of triangles with the vertices of these points.