import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;

import java.util.Locale;

import static ru.ifmo.testlib.Outcome.Type.*;

public class Check implements Checker {
    public static final double EPS = 1e-9;

    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        double icpcOuf = ouf.nextDouble();
        double acmOuf = ouf.nextDouble();
        if (!ouf.seekEoF())
            throw new Outcome(PE, "Extra data in output file");

        double icpcAns = ans.nextDouble();
        double acmAns = ans.nextDouble();
        if (Math.abs(icpcAns - icpcOuf) > EPS)
            throw new Outcome(WA, String.format(Locale.US, "Expected ICPC answer %.10f, found %.10f", icpcAns, icpcOuf));
        if (Math.abs(icpcAns - icpcOuf) > EPS)
            throw new Outcome(WA, String.format(Locale.US, "Expected ACM answer %.10f, found %.10f", acmAns, acmOuf));
        throw new Outcome(OK, String.format(Locale.US, "%.10f %.10f", icpcOuf, acmOuf));
    }
}
