//一直卡在格式上,看英文真心头疼,读题看输入处理分析,输出格式solve方法,一定注意输出格式,认真读题
//离散化连续坐标方法 Uva urbanelevation
//数据结构设计 vector set==vector map==vetor[]string==vector[]struct==vector[]int==vector queue==vector stack UvaPGA 集合栈 database
//字符矩阵转数字矩阵(队列,栈)vector存储分配字符串的标号 uva集合栈计算机 uvaDatabase
//并查集判断树 int rootOf(int a){
// if(a!=node[a])
// node[a]=rootOf(node[a]);
// return node[a];
//} is it a tree
//解答树(排列生成)next_permutation(shz,shz+b); Uva下一个子序列
//dfs 邻接矩阵,vector【】,链表并查集 poj professional john 连通图 poj avoid the lacks poj围棋
//flag标签推进,衡量尺度 Blah数集(poj)
#include<iostream>
#include<cstdio>#include<algorithm>
using namespace std;
struct building{
int id;
double x,y,w,d,h;
bool operator <(building a)const{
return x<a.x||(x==a.x&&y<a.y);
}
}b[105];
int n;
double x[210];
int cover(int i,double d){
return b[i].x<=d&&b[i].x+b[i].w>=d;
}
int vis(int i,double d){
if(!cover(i,d))return 0;
else{
for(int x=0;x<n;x++){
if(cover(x,d)&&b[x].y<b[i].y&&b[x].h>=b[i].h)return 0;
}
}
return 1;
}
int main(){
//连续坐标离散化,离散中点一定属于一个房屋的连续部分,而不是两个元素房屋的部分
//连续坐标离散化方法,输入一个元素的属性,*2,*3位置扩充属性并且相应处理,接着排序去重获得连续坐标的离散化的两端,离散中点有且只有一个元素可对应;
//注意输入去重,PAG循环赛
//连续坐标离散化
int k=0;
while(scanf("%d",&n)==1&&n){
//读取所有房屋属性
for(int i=0;i<n;i++){
scanf("%lf%lf%lf%lf%lf",&b[i].x,&b[i].y,&b[i].w,&b[i].d,&b[i].h);
b[i].id=i+1;
x[i*2]=b[i].x;
x[i*2+1]=b[i].x+b[i].w;
//离散化两边坐标
}
//排序去重离散化坐标
sort(b,b+n);
sort(x,x+n*2);
int m=unique(x,x+n*2)-x;
// cout<<" test"<<m<<" test"<<endl;
if(k++)printf("\n");///
printf("For map #%d, the visible buildings are numbered as follows:\n%d",k,b[0].id);//
for(int i=1;i<n;i++){//检查每一个房屋和元素
int jud=0;
for(int j=0;j<m-1;j++){
if(vis(i,(x[j]+x[j+1])/2)){
jud=1;
break;
}
}
if(jud)printf(" %d",b[i].id);
}
cout<<endl;
}
return 0;
}