Tripartite matching of points in space