{$apptype console}

uses
  testlib, sysutils;

var
	n, m: integer;
	s, e: array of integer;
	i, t: integer;
	jn, jc, cn, cc: integer;
	answ: integer;
	cor: boolean;
begin 
	n := inf.readInteger();
	m := inf.readInteger();
	setLength(s, m);
	setLength(e, m);
	for i := 0 to m - 1 do begin
		s[i] := inf.readInteger() - 1;
		e[i] := inf.readInteger() - 1;
	end;
	jn := ans.readInteger();
	jc := ans.readInteger();
	cn := ouf.readInteger();
	cc := ouf.readInteger();
	if jn <> cn then quit(_wa, 'The number of stations differ: ' + inttostr(cn) + ' instead of ' + inttostr(jn));
	if jc <> cc then quit(_wa, 'The number of ways differ: ' + inttostr(cc) + ' instead of ' + inttostr(jc));

	answ := 0;
	for i := 1 to jn do begin
		answ := answ or (1 shl (ouf.readInteger() - 1));
	end;	

	cor := true;
	for i := 0 to m - 1 do begin
		if ((answ and (1 shl s[i])) = 0) and ((answ and (1 shl e[i])) = 0) then cor := false;
	end;

	if not cor then quit(_wa, 'The sample does not cover the set of channels');
	quit(_ok, 'Ok');
end.