//
// Written by Fyodor Menshikov 01.03.2008
//
{$R+,Q+}

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

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

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

var
   sU, sJ : string;
   i : integer;
begin
   assign(input, 'bignum.out');
   reset(input);
   readln(sU);
   if not eof then begin
      pe;
   end;
   if sU <> '-1' then begin
      if length(sU) = 0 then begin
         pe;
      end;
      if sU[1] = '0' then begin
         pe;
      end;
      for i := 1 to length(sU) do begin
         if not (sU[i] in ['0'..'9']) then begin
            pe;
         end;
      end;
   end;
   assign(input, 'bignum.chk');
   reset(input);
   readln(sJ);
   if sU <> sJ then
      wa;
   ac;
end.