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

public class Check implements Checker {
	double eps = 1e-3;

	boolean same(double value1, double value2) {
		return Math.abs(value2 - value1) < eps;
	}

	@Override
	public Outcome test(InStream inf, InStream ouf, InStream ans) {
		String contestantAns = ouf.nextToken();
		String realAns = ans.nextToken();
		if (!realAns.equals(contestantAns))
			return new Outcome(Type.WA, contestantAns + " found, " + realAns
					+ " expected.");
		if (realAns.equals("NO"))
			return new Outcome(Type.OK, "Ok - Result NO");
		int x1 = inf.nextInt();
		int y1 = inf.nextInt();
		int x2 = inf.nextInt();
		int y2 = inf.nextInt();
		int n = inf.nextInt();
		int[] len = new int[n];
		for (int i = 0; i < n; i++)
			len[i] = inf.nextInt();
		double[] x = new double[n + 1];
		double[] y = new double[n + 1];
		for (int i = 0; i < n + 1; i++) {
			x[i] = ouf.nextDouble();
			y[i] = ouf.nextDouble();
		}
		if (!same(x1, x[0]) || !same(y1, y[0]))
			return new Outcome(Type.WA, "First point doesn't match with A0");
		if (!same(x2, x[n]) || !same(y2, y[n]))
			return new Outcome(Type.WA, "Last point doesn't match with An");
		for (int i = 0; i < n; i++) {
			double dx = x[i + 1] - x[i];
			double dy = y[i + 1] - y[i];
			double dist = Math.sqrt(dx*dx+dy*dy);
			if (!same(dist, len[i])) 
				return new Outcome(Type.WA, "Distance between A" + i + " and A" + (i + 1) + " is " + dist + ", but " + len[i] + " expected.");
		}
		return new Outcome(Type.OK, "Ok - Result YES");
	}

}
