import java.util.Arrays;

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

public class Check implements Checker {

	@Override
	public Outcome test(InStream inf, InStream ouf, InStream ans) {
		int n = inf.nextInt();
		int m = inf.nextInt();
		Edge[] edges = new Edge[m];
		for (int i = 0; i < m; i++) {
			edges[i] = new Edge(inf.nextInt(), inf.nextInt());
		}
		Arrays.sort(edges);
		
		int juryAns = ans.nextInt();
		int partAns = ouf.nextInt();
		
		if (partAns < juryAns) {
			return new Outcome(Type.WA, "Jury has better answer");
		}
		
		int[] cycle = new int[partAns];
		for (int i = 0; i < partAns; i++) {
			cycle[i] = ouf.nextInt();
			if (cycle[i] < 1 || n < cycle[i]) {
				return new Outcome(Type.WA, "Vertex number is not in [1..n] segment");
			}
		}
		
		if (!allDifferent(cycle)) {
			return new Outcome(Type.WA, "There are repeated vertices in cycle");
		}
		
		for (int i = 0; i < partAns - 1; i++) {
			Edge edge = new Edge(cycle[i], cycle[i + 1]);
			if (Arrays.binarySearch(edges, edge) < 0) {
				return new Outcome(Type.WA, "Edge " + edge + " does not present in graph");
			}
		}
		Edge edge = new Edge(cycle[0], cycle[partAns - 1]);
		if (Arrays.binarySearch(edges, edge) < 0) {
			return new Outcome(Type.WA, "Edge " + edge + " does not present in graph");
		}
		
		if (partAns > juryAns) {
			return new Outcome(Type.FAIL, "Participant found better answer");
		}
		
		return new Outcome(Type.OK, "oK");
	}
	
	private boolean allDifferent(int[] cycle) {
		int[] a = cycle.clone();
		Arrays.sort(a);
		for (int i = 0; i < a.length - 1; i++) {
			if (a[i] == a[i + 1]) {
				return false;
			}
		}
		return true;
	}

	class Edge implements Comparable<Edge> {
		int from, to;

		public Edge(int from, int to) {
			super();
			this.from = Math.min(from, to);
			this.to = Math.max(from, to);
		}
		
		@Override
		public int compareTo(Edge o) {
			if (from == o.from){
				return to - o.to;
			}
			return from - o.from;
		}
		
		@Override
		public String toString() {
			return "(" + from + ", " + to + ")";
		}
	}
}