program acm1909; var n,i,t,top:integer; ch:string; a:array[1..10000]of longint; begin readln(n); while n<>0 do begin top:=0; for i:=1 to n do begin readln(ch); if ch[1]='P' then begin ch:=copy(ch,2,length(ch)); val(ch,t); inc(top); a[top]:=t; end; if (ch[1]='O')and(top>0) then dec(top); if ch[1]='A' then begin if top=0 then writeln('E') else writeln(a[top]); end; end; writeln; readln(n); end; end. /************************************************************** Problem: 2192 User: admin Language: Pascal Result: Wrong Answer ****************************************************************/