{
Written by Fyodor Menshikov 24.02.2006
}
   procedure ac;
   begin
      writeln('a');
      halt(0);
   end;

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

   procedure pe(id:integer);
   begin
      writeln('pe',id);
      halt(2);
   end;

var
   nGood,nUser,i:integer;
   good,user:array[1..40]of string;
   UserLabels,MaxLabel,VariableOrderU,VariableOrderJ,s:string;
   PrevLineLabel:boolean;
begin
   assign(input,'compiler.chk');
   reset(input);
   nGood:=0;
   while not eof do begin
      inc(nGood);
      readln(good[nGood]);
   end;
   assign(input,'compiler.out');
   reset(input);
   nUser:=0;
   while not eof do begin
      inc(nUser);
      {26 variables => 13 comparisons => max 13 labels}
      if nUser>13+13+3 then begin
         pe(1);
      end;
      readln(user[nUser]);
   end;
   if nUser<4 then begin
      pe(2);
   end;
   if user[nUser-2]<>'true:' then begin
      pe(3);
   end;
   if user[nUser-1]<>'   something;' then begin
      pe(4);
   end;
   if user[nUser]<>'false:' then begin
      pe(5);
   end;
   for i:=1 to nUser-3 do begin
      if length(user[i])<3 then begin
         pe(6);
      end;
   end;
   UserLabels:='';
   for i:=1 to nUser-3 do begin
      if length(user[i])=3 then begin
         if user[i][1] in ['0'..'9'] then begin
            UserLabels:=UserLabels+user[i][1];
         end
         else begin
            pe(7);
         end;
         if user[i][2] in ['0'..'9'] then begin
            UserLabels:=UserLabels+user[i][2];
         end
         else begin
            pe(8);
         end;
         if user[i][3]<>':' then begin
            pe(9);
         end;
      end;
   end;
   if (UserLabels<>'') and (pos(UserLabels,'01020304050607080910111213')<>1) then begin
      pe(10);
   end;
   MaxLabel:=UserLabels;
   while length(MaxLabel)>2 do begin
      delete(MaxLabel,1,1);
   end;
   PrevLineLabel:=false;
   for i:=1 to nUser-3 do begin
      if length(user[i])=3 then begin
         if PrevLineLabel then begin
            pe(11);
         end;
         PrevLineLabel:=true;
      end
      else begin
         PrevLineLabel:=false;
      end;
   end;
   if PrevLineLabel then begin
      pe(12);
   end;
   VariableOrderJ:='';
   for i:=1 to nGood do begin
      if copy(good[i],1,6)='   if ' then begin
         assert(good[i][7] in ['a'..'z']);
         VariableOrderJ:=VariableOrderJ+good[i][7];
         if good[i][9] in ['a'..'z'] then begin
            VariableOrderJ:=VariableOrderJ+good[i][9];
         end
         else if good[i][10] in ['a'..'z'] then begin
            VariableOrderJ:=VariableOrderJ+good[i][10];
         end
         else begin
            assert(false);
         end;
      end;
   end;
   VariableOrderU:='';
   for i:=1 to nUser-3 do begin
      if length(user[i])<>3 then begin
         s:=user[i];
         if length(s)<length('   if a<b then goto 00;') then begin
            pe(13);
         end;
         if copy(s,1,6)<>'   if ' then begin
            pe(14);
         end;
         delete(s,1,6);
         if not (s[1] in ['a'..'z']) then begin
            pe(15);
         end;
         VariableOrderU:=VariableOrderU+s[1];
         delete(s,1,1);
         if s[1]='<' then begin
            if s[2]='=' then begin
               delete(s,1,2);
            end
            else if s[2]='>' then begin
               delete(s,1,2);
            end
            else begin
               delete(s,1,1);
            end;
         end
         else if s[1]='>' then begin
            if s[2]='=' then begin
               delete(s,1,2);
            end
            else begin
               delete(s,1,1);
            end;
         end
         else if s[1]='=' then begin
            delete(s,1,1);
         end
         else begin
            pe(16);
         end;
         if not (s[1] in ['a'..'z']) then begin
            pe(17);
         end;
         VariableOrderU:=VariableOrderU+s[1];
         delete(s,1,1);
         if pos(' then goto ',s)<>1 then begin
            pe(18);
         end;
         delete(s,1,11);
         if (s<>'true;') and (s<>'false;') then begin
            if length(s)<>3 then begin
               pe(19);
            end;
            if s[3]<>';' then begin
               pe(20);
            end;
            delete(s,3,1);
            if not (s[1] in ['0'..'9']) then begin
               pe(21);
            end;
            if not (s[2] in ['0'..'9']) then begin
               pe(22);
            end;
            if (s<'01') or (s>MaxLabel) then begin
               pe(23);
            end;
         end;
      end;
   end;
   if VariableOrderJ<>VariableOrderU then begin
      pe(24);
   end;
   if nUser<>nGood then begin
      wa;
   end;
   for i:=1 to nUser do begin
      if user[i]<>good[i] then begin
         wa;
      end;
   end;
   ac;
end.