import java.util.*;
import java.util.stream.Collectors;
public class PekkaPouta {
@SuppressWarnings({"SpellCheckingInspection", "ForLoopReplaceableByForEach"})
static class Paiva {
double[] oikea = new double[12];
double[] edellinenPaiva = new double[24];
double[] arvaus = new double[12];
double keskiarvo = 1;
public Paiva() {
Arrays.fill(arvaus, Double.NaN);
}
static class P {
public P(int a, int b) {this.a = a;this.b = b;}
int a,b;
}
boolean isTasainen(double maxEro) {
double summa = 0;
double maara = 0;
for (int i = 0; i < edellinenPaiva.length; i++) {
summa += edellinenPaiva[i];
maara++;
}
double keskiarvo = summa / maara;
this.keskiarvo = keskiarvo;
for (int i = 0; i < edellinenPaiva.length; i++) {
if (Math.abs(edellinenPaiva[i] - keskiarvo) > maxEro ) {
return false;
}
}
return true;
}
P pisteet() {
int a = 0;
int b = 0;
for (int i = 0; i < arvaus.length; i++) {
double arv = arvaus[i];
if (Double.isNaN(arv)) continue; //?
double oik = oikea[i];
if (Math.abs(arv - oik) < 0.75) a++;
else b++;
}
return new P(a,b);
}
}
@SuppressWarnings("UnusedReturnValue")
int main() {
Scanner scanner = new Scanner(Objects.requireNonNull(Datatahti.class.getResourceAsStream("/input.txt")));
int n = Integer.parseInt(scanner.nextLine());
ArrayList<Paiva> paivat = new ArrayList<>(n);
for (int i = 0; i < n; i++) {
String[] line = scanner.nextLine().split(" ");
Paiva paiva = new Paiva();
for (int j = 0; j < line.length; j++) {
double d = Double.parseDouble(line[j]);
if (j < 24) {
paiva.edellinenPaiva[j] = d;
} else {
paiva.oikea[j-24] = d;
}
}
paivat.add(paiva);
}
double maxEro = 1;
List<Paiva> tasaiset = paivat.stream().filter(paiva -> paiva.isTasainen(maxEro)).collect(Collectors.toList());
//System.out.println("Tasaisia " + tasaiset.size());
for (Paiva paiva : tasaiset) {
for (int i = 0; i < 12; i++) {
paiva.arvaus[i] = paiva.keskiarvo;
}
}
for (Paiva paiva : paivat) {
paiva.arvaus[0] = paiva.edellinenPaiva[23];
paiva.arvaus[1] = paiva.edellinenPaiva[23];
paiva.arvaus[2] = paiva.edellinenPaiva[23];
}
int a = 0;
int b = 0;
int at = 0;
int bt = 0;
for (Paiva paiva : paivat) {
Paiva.P pisteet = paiva.pisteet();
a += pisteet.a;
b += pisteet.b;
if (paiva.isTasainen(maxEro)) {
at += pisteet.a;
bt += pisteet.b;
}
}
//System.out.println(a + " " + b + " " + n);
//System.out.println(at + " " + bt);
//System.out.println(a / (double)(b+a));
//System.out.println((int)(25 * (a-b) / (double)n));
StringBuilder builder = new StringBuilder();
for (Paiva paiva : paivat) {
for (double arvaus : paiva.arvaus) {
if (Double.isNaN(arvaus)) builder.append("? ");
else builder.append(arvaus).append(" ");
}
builder.append("\n");
}
System.out.println(builder);
return 0;
}
public static void main(String[] args) {
new PekkaPouta().main();
}
}