#include<cstdio> const int MAXN=100+5; const int MAXL=5+5; int pos[MAXN][4],totwin,x1,y1,x2,y2,n;char op[MAXL]; void OrderChange(int src,int targ) { for(int i=0;i<4;i++) pos[targ][i]=pos[src][i]; } int FindWindow(int x,int y) { for(int i=1;i<=totwin;i++) if(x>=pos[i][0] && y>=pos[i][1] && x<=pos[i][2] && y<=pos[i][3]) return i; return 0; } void SetValue() { pos[1][0]=x1;pos[1][1]=y1;pos[1][2]=x2;pos[1][3]=y2; } int main() { int targ; scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%s",op); if(op[2]=='e') { scanf("%d %d %d %d",&x1,&y1,&x2,&y2); for(int i=totwin;i>=1;i--) OrderChange(i,i+1); SetValue(); totwin++; } if(op[2]=='i') { scanf("%d %d",&x1,&y1); targ=FindWindow(x1,y1); if(!targ) continue; x1=pos[targ][0];y1=pos[targ][1];x2=pos[targ][2];y2=pos[targ][3]; for(int i=targ-1;i>=1;i--) OrderChange(i,i+1); SetValue(); } if(op[2]=='o') { scanf("%d %d",&x1,&y1); targ=FindWindow(x1,y1); if(!targ) continue; for(int i=targ+1;i<=totwin;i++) OrderChange(i,i-1); totwin--; } if(op[2]=='v') { scanf("%d %d %d %d",&x1,&y1,&x2,&y2); targ=FindWindow(x1,y1); pos[targ][0]+=x2;pos[targ][1]+=y2;pos[targ][2]+=x2;pos[targ][3]+=y2; x1=pos[targ][0];y1=pos[targ][1];x2=pos[targ][2];y2=pos[targ][3]; for(int i=targ-1;i>=1;i--) OrderChange(i,i+1); SetValue(); } } if(!totwin) printf("Nothing"); else {for(int i=0;i<4;i++) printf("%d ",pos[1][i]);} return 0; }
|