#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int MAXN = 3000;
struct sub_node{int la, ra, _maxl;};
struct node{int lh, rh;sub_node sub_t[MAXN];}t[MAXN];
void build_sub(int id, int sub_id, int la, int ra)
{
t[id].sub_t[sub_id].la = la;
t[id].sub_t[sub_id].ra = ra;
t[id].sub_t[sub_id]._maxl = -1;
if(la == ra) return ;
int mid = (ra+la)>>1;
build_sub(id,sub_id<<1,la,mid);
build_sub(id,sub_id<<1|1,mid+1,ra);
}
void build(int id, int lh, int rh, int la, int ra)
{
t[id].lh = lh;t[id].rh = rh;
build_sub(id,1,la,ra);
if(rh==lh) return;
int mid = (lh+rh)>>1;
build(id<<1,lh,mid,la,ra);
build(id<<1|1,mid+1,rh,la,ra);
}
void updata_sub(int id, int sub_id, int active, int love)
{
if(t[id].sub_t[sub_id].la == t[id].sub_t[sub_id].ra)
{
t[id].sub_t[sub_id]._maxl = max(t[id].sub_t[sub_id]._maxl, love); return;
}
int mid = (t[id].sub_t[sub_id].la+t[id].sub_t[sub_id].ra)>>1;
if(active<=mid) updata_sub(id,sub_id*2,active,love);
else updata_sub(id,sub_id*2+1,active,love);
t[id].sub_t[sub_id]._maxl = max(t[id].sub_t[sub_id]._maxl,love);
}
void updata(int id, int hight, int active, int love)
{
updata_sub(id, 1, active, love);
if(t[id].lh == t[id].rh) return;
int mid = (t[id].lh+t[id].rh)>>1;
if(hight<=mid) updata(id*2,hight,active,love);
else updata(id*2+1,hight,active,love);
}
int query_sub(int id, int sub_id, int la, int ra)
{
if(t[id].sub_t[sub_id].la == la && t[id].sub_t[sub_id].ra == ra) return t[id].sub_t[sub_id]._maxl;
int mid = (t[id].sub_t[sub_id].la+t[id].sub_t[sub_id].ra)>>1;
if(ra<=mid) query_sub(id,sub_id*2,la,ra);
else if(la>mid) query_sub(id,sub_id*2+1,la,ra);
else return max(query_sub(id,sub_id*2,la,mid),query_sub(id,sub_id*2+1,mid+1,ra));
}
int query(int id, int lh, int rh, int la, int ra)
{
if(t[id].lh == lh && t[id].rh == rh)
return query_sub(id,1,la,ra);
int mid = (t[id].lh+t[id].rh)>>1;
if(rh<=mid) query(id*2,lh,rh,la,ra);
else if(lh>mid) query(id*2+1,lh,rh,la,ra);
else return max(query(id*2,lh,mid,la,ra),query(id*2+1,mid+1,rh,la,ra));
}
int main()
{
int n;
int hight,active,love;
while(cin>>n,n)
{
build(1,100,200,0,1000);
for(int i=0; i<n; i++)
{
char ch;
cin>>ch;
if(ch=='I')
{
double a,b;
cin>>hight>>a>>b;
active = (int)(a*10);
love = (int)(b*10);
updata(1,hight,active,love);
}
else
{
int a,b;
double c,d;
cin>>a>>b>>c>>d;
double ans ;
if(a>b) swap(a,b);
if(c>d) swap(c,d);
ans = query(1,a,b,(int)(c*10),(int)(d*10));
if(ans<0) cout<<-1<<endl;
else
printf("%.1lf\n",ans/10);
}
}
}
return 0;
}
坑点在所给范围会出现前者大于后者。