//
// Written by Fyodor Menshikov 23.03.2007
//

   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
   uf, jf : text;
   wasWA : boolean;
   us, js : string;
   i, n_dots, num : integer;
   isPrevDot : boolean;
begin
   assign(uf, 'output.txt');
   reset(uf);
   assign(jf, 'check.txt');
   reset(jf);
   wasWA := false;
   while true do begin
      if eof(uf) and eof(jf) then begin
         break;
      end;
      if eof(uf) or eof(jf) then begin
         pe;
      end;
      readln(uf, us);
      readln(jf, js);
      if us = js then begin
         continue;
      end;
      wasWA := true;
      if us = 'NO ROUTE' then begin
         continue;
      end;
      n_dots := 0;
      num := 0;
      isPrevDot := true;
      us := us + '.';
      for i := 1 to length(us) do begin
         if us[i] = '.' then begin
            if isPrevDot then begin
               pe;
            end;
            isPrevDot := true;
            num := 0;
            inc(n_dots);
         end
         else if us[i] in ['1'..'9'] then begin
            isPrevDot := false;
            num := num * 10 + ord(us[i]) - ord('0');
            if num > 255 then begin
               pe;
            end;
         end
         else if us[i] = '0' then begin
            if isPrevDot then begin
               isPrevDot := false;
            end
            else begin
               if num = 0 then begin
                  pe;
               end;
               num := num * 10;
               if num > 255 then begin
                  pe;
               end;
            end;
         end
         else begin
            pe;
         end;
      end;
      if n_dots <> 4 then begin
         pe;
      end;
   end;
   if wasWA then begin
      wa;
   end;
   ac;
end.