problem : topology vs geometry

stuck on this problem pls. help

I was solving like this : total no. of vertices is equal to \ 3 * n and for a complete mesh two vertices of triangles must be in common so no. of vertices in a mesh is \ 2 * (n - 1) so put all input vertices in a set and check if size if equal to \ 3 *n - 2*(n - 1) but failed on TC 4 after solving on paper I found that this approach is totally wrong.

Second : calculate distance between each vertices and check if distance and pair of vertices present in set.