import java.util.*;
import java.io.*;
import java.text.*;

public class NickyEnMark{
    static int NUM_CENTERS = 250;
    static int NUM_LOOPS = 0;

    public static void main(String[] args) throws IOException {
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(System.in))) {
            String line = reader.readLine();
            int n = Integer.parseInt(line);
            double[] x = new double[n];
            double[] y = new double[n];
            double[] z = new double[n];
            for (int i = 0; i < n; i++) {
                String[] line2 = reader.readLine().split(" ");
                x[i] = (double)Integer.parseInt(line2[0]);
                y[i] = (double)Integer.parseInt(line2[1]);
                z[i] = (double)Integer.parseInt(line2[2]);
            }

            Random r = new Random();
            double[] cx = new double[NUM_CENTERS];
            double[] cy = new double[NUM_CENTERS];
            double[] cz = new double[NUM_CENTERS];

            for (int i = 0; i < NUM_CENTERS; i++) {
                cx[i] = (double)r.nextInt(1000000000);
                cy[i] = (double)r.nextInt(1000000000);
                cz[i] = (double)r.nextInt(1000000000);
            }

            int[] assignedCenter = closestCenters(n, x, y, z, cx, cy, cz);
            recalculateCenters(n, x, y, z, cx, cy, cz, assignedCenter);

            for (int l = 0; l < NUM_LOOPS; l++) {
                assignedCenter = closestCenters(n, x, y, z, cx, cy, cz);
                recalculateCenters(n, x, y, z, cx, cy, cz, assignedCenter);
            }

            ArrayList<ArrayList<Integer>> pointsPerCenter = new ArrayList<>();
            for (int c = 0; c < NUM_CENTERS; c++) {
                pointsPerCenter.add(new ArrayList<Integer>());
            }
            for (int i = 0; i < n; i++) {
                pointsPerCenter.get(assignedCenter[i]).add(i);
            }

            double closestDistance = -1;
            for (int c = 0; c < NUM_CENTERS; c++) {
                for (int i = 0; i < pointsPerCenter.get(c).size(); i++) {
                    for (int j = 0; j < pointsPerCenter.get(c).size(); j++) {
                        if (i == j) {
                            continue;
                        }
                        int p1 = pointsPerCenter.get(c).get(i);
                        int p2 = pointsPerCenter.get(c).get(j);

                        double d = Math.sqrt(
                            (x[p1] - x[p2]) * (x[p1] - x[p2])
                            +
                            (y[p1] - y[p2]) * (y[p1] - y[p2])
                            +
                            (z[p1] - z[p2]) * (z[p1] - z[p2])
                        );
                        if (closestDistance == -1 || d < closestDistance) {
                            closestDistance = d;
                        }
                    }
                }
            }

            System.out.println(closestDistance);
        }
    }

    static int[] closestCenters(int n, double[] x, double[] y, double[] z, double[] cx, double[] cy, double[] cz) {
        int[] assignedCenter = new int[n];
        for (int i = 0; i < n; i++) {
            int closest = -1;
            double closestDistance = -1;
            for (int j = 0; j < NUM_CENTERS; j++) {
                double d = 
                    (x[i] - cx[j]) * (x[i] - cx[j])
                    +
                    (y[i] - cy[j]) * (y[i] - cy[j])
                    +
                    (z[i] - cz[j]) * (z[i] - cz[j])
                ;
                if (closest == -1) {
                    closest = j;
                    closestDistance = d;
                    continue;
                }

                if (d < closestDistance) {
                    closest = j;
                    closestDistance = d;
                }
            }

            assignedCenter[i] = closest;
        }

        return assignedCenter;
    }

    static void recalculateCenters(int n, double[] x, double[] y, double[] z, double[] cx, double[] cy, double[] cz, int[] assignedCenter) {
        double[] totalx = new double[NUM_CENTERS];
        double[] totaly = new double[NUM_CENTERS];
        double[] totalz = new double[NUM_CENTERS];
        int[] assignedPerCenter = new int[NUM_CENTERS];

        for (int i = 0; i < n; i++) {
            int center = assignedCenter[i];
            totalx[center] += x[i];
            totaly[center] += y[i];
            totalz[center] += z[i];
            assignedPerCenter[center]++;
        }

        for (int i = 0; i < NUM_CENTERS; i++) {
            if (assignedPerCenter[i] > 0) {
                cx[i] = totalx[i] / assignedPerCenter[i];
                cy[i] = totaly[i] / assignedPerCenter[i];
                cz[i] = totalz[i] / assignedPerCenter[i];
            }
        }
    }
}