// Arup Guha
// 9/2/2016
// Alternate Solution to 2016 UCF Locals Problem: Dot the i's and cross the T's.

import java.util.*;

public class findt2 {

	final public static double EPSILON = 1e-8;

	public static int n;
	public static pt[] pts;

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Go through each case.
		for (int loop=1; loop<=numCases; loop++) {

			n = stdin.nextInt();
			pts = new pt[n];

			// Read in points and sort.
			for (int i=0; i<n; i++) {
				double x = stdin.nextDouble();
				double y = stdin.nextDouble();
				pts[i] = new pt(x,y);
			}
			Arrays.sort(pts);

			// Set up recursion.
			int[] combo = new int[3];
			boolean[] used = new boolean[n];

			// Our method of counting double counts T, so divide by 2.
			System.out.println("Set #"+loop+": "+(solveRec(combo, used, 0)/2)+"\n");
		}
	}

	public static int solveRec(int[] combo, boolean[] used, int k) {

		// Filled a combination, see if it works.
		if (k == combo.length) {
			int res = 0;

			// Need a right angle. If it is, calculate the 4th pt and see if it's in the list or not.
			if (rightAngle(combo) && rightDist(combo)) {
				pt pt4 = getDoublePt(pts[combo[0]], pts[combo[1]]);
				if (Arrays.binarySearch(pts, 0, n, pt4) >= 0) res++;
			}
			return res;
		}

		int res = 0;

		// Try each possible item in slot k.
		for (int i=0; i<n; i++) {
			if (!used[i]) {
				combo[k] = i;
				used[i] = true;
				res += solveRec(combo, used, k+1);
				used[i] = false;
			}
		}

		// Here it is.
		return res;
	}

	public static pt getDoublePt(pt a, pt b) {
		pt vect = a.getVect(b);
		return 	b.add(vect);
	}

	public static boolean rightAngle(int[] combo) {
		pt v1 = pts[combo[1]].getVect(pts[combo[0]]);
		pt v2 = pts[combo[1]].getVect(pts[combo[2]]);
		return Math.abs(v1.dot(v2)) < EPSILON;
	}

	public static boolean rightDist(int[] combo) {
		return Math.abs(2*pts[combo[1]].dist(pts[combo[0]]) - pts[combo[1]].dist(pts[combo[2]])) < EPSILON;
	}
}

class pt implements Comparable<pt> {

	final public static double EPSILON = 1e-8;

	public double x;
	public double y;

	public pt(double myx, double myy) {
		x = myx;
		y = myy;
	}

	// Sort by x, breaking ties by y.
	public int compareTo(pt other) {
		if (x < other.x-EPSILON) return -1;
		if (x > other.x+EPSILON) return 1;
		if (y < other.y-EPSILON) return -1;
		if (y > other.y+EPSILON) return 1;
		return 0;
	}

	public pt getVect(pt dest) {
		return new pt(dest.x-x, dest.y-y);
	}

	public pt add(pt vect) {
		return new pt(x+vect.x,y+vect.y);
	}

	// Returns the dot product of this vector and v2.
	public double dot(pt v2) {
		return x*v2.x + y*v2.y;
	}

	public double dist(pt other) {
		return Math.sqrt((x-other.x)*(x-other.x) + (y-other.y)*(y-other.y));
	}
}