//
// Written by Fyodor Menshikov 07.03.2010
//

	procedure ac;
	begin
		writeln('a');
		halt(0);
	end;

	procedure wa;
	begin
		writeln('wa');
		halt(1);
	end;

	procedure pe;
	begin
		writeln('pe');
		halt(2);
	end;

	procedure ie;
	begin
		writeln('ie');
		while true do;
	end;

var
	uf, jf : text;
	us, js : string;
	wasWA : boolean;
begin
	assign(jf, 'brackets.chk');
	reset(jf);
	assign(uf, 'brackets.out');
	reset(uf);
	wasWA := false;
	while not eof(uf) do begin
		if eof(jf) then begin
			pe;
		end;
		readln(uf, us);
		readln(jf, js);
		if (us <> '+') and (us <> '-') then begin
			pe;
		end;
		if (js <> '+') and (js <> '-') then begin
			ie;
		end;
		if us <> js then begin
			wasWA := true;
		end;
	end;
	if not eof(jf) then begin
		pe;
	end;
	if wasWA then begin
		wa;
	end;
	ac;
end.