uses testlib,SysUtils;
const
	NN = 60000;
type
	REB = record
		a,p: longint;
	end;
var
	n,m: longint;
	swp: array [1..2*NN] of REB;
	iswp: longint;
	g: array [1..NN] of longint;
	q,r: array [1..NN] of longint;
	used: array [1..NN] of boolean;
	b,e: longint;

procedure add(x,y: longint);
begin
	iswp := iswp + 1;
	swp[iswp].p := g[x];
	swp[iswp].a := y;
	g[x] := iswp;
	iswp := iswp + 1;
	swp[iswp].p := g[y];
	swp[iswp].a := x;
	g[y] := iswp;
end;

procedure bfs;
var
	t: longint;
begin
	while b < e do begin
		t := g[q[b]];
		while t <> 0 do begin
			if not used[swp[t].a] then begin
				q[e] := swp[t].a;
				used[q[e]] := true;
				r[q[e]] := r[q[b]] + 1;
				inc(e);
			end;
			t := swp[t].p;
		end;
		inc(b);
	end;
end;

var
	i: longint;
	x,y: longint;

begin
	n := inf.readlongint;
	m := inf.readlongint;
	b := 1; e := 1;
	for i := 1 to n do begin
		used[i] := false;
		g[i] := 0;
	end;
	for i := 1 to m do begin
		q[e] := inf.readlongint;
		used[q[e]] := true;
		inc(e);
	end;
	for i := 1 to n-1 do begin
		x := inf.readlongint;
		y := inf.readlongint;
		add(x,y);
	end;
	x := ouf.readlongint;
	if (x < 1) or (x > n) then quit(_pe,'Not a vertex');
	if used[x] then quit(_wa,'Vertex is already in use');
	q[e] := x;
	used[x] := true;
	inc(e);
	bfs();
	x := r[1];
	for i := 2 to n do begin
		if r[i] > x then x := r[i];
	end;
	y := ans.readlongint;
	if x < y then quit(_fail,'Contestant is better');
	if x > y then quit(_wa,'Not optimal');
	quit(_ok,inttostr(n)+' vertexes, '+inttostr(m)+' stations');
end.
