{
Written by Fyodor Menshikov 07.02.2004
}
{$R+,Q+}

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

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

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

var
   c:char;

   procedure nextchar;
   begin
      if eoln then
         c:=#13
      else
         read(c);
   end;

var
   judgeanswer,useranswer:string;
   userlen:longint;
begin
   assign(input,'check.txt');
   reset(input);
   readln(judgeanswer);
   assign(input,'output.txt');
   reset(input);
   nextchar;
   if c='0' then begin
      nextchar;
      if c<>#13 then
         pe;
      readln;
      if not eof then
         pe;
      if judgeanswer<>'0' then
         wa;
      ac;
   end;
   userlen:=0;
   while c in ['0'..'9'] do begin
      inc(userlen);
      nextchar;
   end;
   if c<>#13 then
      pe;
   readln;
   if not eof then
      pe;
   if length(judgeanswer)<>userlen then
      wa;
   reset(input);
   readln(useranswer);
   if useranswer<>judgeanswer then
      wa;
   ac;
end.