using System;
using System.Linq;
public class Quickstart
{
static double SZ = 10.0;
static int INF = 1000000000;
static int IT = 100;
static int IT_UE = 100;
static double C_NS = 0.299792458;
int n;
double[][] bs;
double[][] ue;
double[][] t;
double[][] bs_best;
double[][] ue_best;
double[] toa;
private void ReadInput()
{
n = Int32.Parse(Console.ReadLine());
bs = new double[4][];
for (int i = 0; i < 4; ++i)
{
bs[i] = new double[2];
}
for (int i = 0; i < 2; ++i)
bs[i] = Console.ReadLine().Split(' ').Select(s => Convert.ToDouble(s)).ToArray();
t = new double[n][];
for (int i = 0; i < n; ++i)
t[i] = Console.ReadLine().Split(' ').Select(s => Convert.ToDouble(s)).ToArray();
}
private void WriteOutput()
{
for (int i = 2; i < 4; ++i)
Console.WriteLine(bs_best[i][0].ToString() + " " + bs_best[i][1].ToString());
for (int i = 0; i < n; ++i)
Console.WriteLine(ue_best[i][0].ToString() + " " + ue_best[i][1].ToString());
}
public void Solve()
{
toa = new double[4];
Random rand = new Random();
double min_loss = INF;
bs_best = new double[4][];
for (int i = 0; i < 4; ++i)
{
bs_best[i] = new double[2];
}
ue = new double[n][];
ue_best = new double[n][];
for (int i = 0; i < n; ++i)
{
ue[i] = new double[2];
ue_best[i] = new double[2];
}
for (int i = 0; i < IT; ++i)
{
bs[2][0] = -rand.NextDouble() * SZ;
bs[2][1] = rand.NextDouble() * SZ;
bs[3][0] = rand.NextDouble() * SZ;
bs[3][1] = rand.NextDouble() * SZ;
double loss_tdoa = 0;
for (int j = 0; j < n; ++j)
{
double min_loss_ue = INF;
for (int k = 0; k < IT_UE; ++k)
{
double ue_x = (rand.NextDouble() * 2 - 1) * SZ;
double ue_y = (rand.NextDouble() * 2 - 1) * SZ;
for (int l = 0; l < 4; ++l)
toa[l] =
Math.Sqrt(
(ue_x - bs[l][0]) * (ue_x - bs[l][0])
+ (ue_y - bs[l][1]) * (ue_y - bs[l][1])
) / C_NS;
double loss = 0;
for (int l = 1; l < 4; ++l)
loss +=
((toa[l] - toa[0]) - (t[j][l] - t[j][0]))
* ((toa[l] - toa[0]) - (t[j][l] - t[j][0]));
if (loss < min_loss_ue)
{
min_loss_ue = loss;
ue[j][0] = ue_x;
ue[j][1] = ue_y;
}
}
loss_tdoa += min_loss_ue;
}
if (loss_tdoa < min_loss)
{
min_loss = loss_tdoa;
for (int j = 0; j < 4; ++j)
{
bs_best[j][0] = bs[j][0];
bs_best[j][1] = bs[j][1];
}
for (int j = 0; j < n; ++j)
{
ue_best[j][0] = ue[j][0];
ue_best[j][1] = ue[j][1];
}
}
}
}
public static void Main()
{
Quickstart solver = new Quickstart();
solver.ReadInput();
solver.Solve();
solver.WriteOutput();
}
}