// Arup Guha
// 1/18/2014
// Solution to 2006 MCPC Problem F: Go Go Gorelians

import java.util.*;

public class f {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();

		// Go through each case.
		while (n != 0) {

			// Read in each point and ID.
			vertex[] V = new vertex[n];
			for (int i=0; i<n; i++) {
				int a = stdin.nextInt();
				int b = stdin.nextInt();
				int c = stdin.nextInt();
				int d = stdin.nextInt();
				V[i] = new vertex(a, b, c, d);
			}

			// Create graph and run Floyd's (this is asymptotically slow.
			// A BFS from every node is better by a factor of n.
			boolean[][] g = formGraph(V);
			int[][] adj = getFloyd(g);

			// Find the minimum distance desired and get nodes that achieve that distance.
			int min = getMinDist(adj);
			ArrayList<Integer> loc = getMinLoc(adj, V, min);

			// Print those out.
			for (int i=0; i<loc.size()-1; i++)
				System.out.print(loc.get(i)+" ");
			System.out.println(loc.get(loc.size()-1));

			n = stdin.nextInt();
		}
	}

	public static ArrayList<Integer> getMinLoc(int[][] adj, vertex[] V, int min) {

		int n = adj.length;
		ArrayList<Integer> ans = new ArrayList<Integer>();

		// Add each vertex that has the maximum distance to any place equal to min.
		for (int i=0; i<n; i++) {

			int curMin = 0;
			for (int j=0; j<n; j++)
				if (adj[i][j] > curMin)
					curMin = adj[i][j];

			if (curMin == min)
				ans.add(V[i].ID);
		}

		// This is the order they want it...
		Collections.sort(ans);
		return ans;
	}

	// Find the distance that is minimum such that from any node, all others can be reached.
	public static int getMinDist(int[][] adj) {

		// Set simple upper bound.
		int n = adj.length;
		int minVal = 0, minNode = 0;
		for (int i=0; i<n; i++)
			if (adj[0][i] > minVal)
				minVal = adj[0][i];

		// Go through rest, decreasing if necessary.
		for (int i=1; i<n; i++) {

			int curMin = 0;
			for (int j=0; j<n; j++)
				if (adj[i][j] > curMin)
					curMin = adj[i][j];

			if (curMin < minVal)
				minVal = curMin;
		}

		return minVal;
	}

	// Just returns floyd warshall's end matrix given adjacency matrix g.
	public static int[][] getFloyd(boolean[][] g) {

		// Go from booleans to ints.
		int n = g.length;
		int[][] adj = new int[n][n];
		for (int i=0; i<n; i++) {
			Arrays.fill(adj[i], 10000000);
			adj[i][i] = 0;
		}
		for (int i=0; i<n; i++)
			for (int j=0; j<n; j++)
				if (g[i][j])
					adj[i][j] = 1;

		// Run Floyd's
		for (int k=0; k<n; k++)
			for (int i=0; i<n; i++)
				for (int j=0; j<n; j++)
					adj[i][j] = Math.min(adj[i][j], adj[i][k]+adj[k][j]);

		return adj;
	}

	public static boolean[][] formGraph(vertex[] V) {

		int n = V.length;
		
		// Connect first two places.
		boolean[][] ans = new boolean[n][n];
		ans[0][1] = true;
		ans[1][0] = true;

		// Simulate rest.
		for (int i=2; i<n; i++) {

			// Find best connector for vertex i.
			int best = 0;
			for (int j=1; j<i; j++) {
				if (V[j].dist(V[i]) < V[best].dist(V[i]))
					best = j;
			}

			// Connect it.
			ans[i][best] = true;
			ans[best][i] = true;
		}

		return ans;
	}
}

class vertex {

	public int ID;
	public int x;
	public int y;
	public int z;

	public vertex(int a, int b, int c, int d) {
		ID = a;
		x = b;
		y = c;
		z = d;
	}

	public double dist(vertex other) {
		return Math.sqrt(Math.pow(x-other.x,2) + Math.pow(y-other.y,2) + Math.pow(z-other.z,2));
	}
}