#include <bits/stdc++.h>
using namespace std;
float maxn=9999.9;
struct rec{
float lx;
float uy;
float rx;
float dy;
};
int main()
{
char state;
rec re[10];
int i=0;
while(cin>>state){
if(state=='*') break;
cin>>re[i].lx>>re[i].uy>>re[i].rx>>re[i].dy;
i++;
}
float x,y;
int cnt=1;
while(cin>>x>>y){
if(x==maxn&&y==maxn) break;
int stat=0;
for(int j=0;j<=i;j++){
if((re[j].lx<x&&x<re[j].rx)&&(re[j].dy<y&&y<re[j].uy)){
cout<<"Point "<<cnt<<" is contained in figure "<<j+1<<endl;
stat=1;
}
}
if(stat==0){
cout<<"Point "<<cnt<<" is not contained in any figure"<<endl;
}
cnt++;
}
return 0;
}