#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct Rec {
double l_up_x;
double l_up_y;
double r_down_x;
double r_down_y;
};
bool IsInRec(Rec rec,double x,double y){
if(rec.l_up_x < x && x < rec.r_down_x){
if(rec.l_up_y > y && y > rec.r_down_y){
return true;
}
}
return false;
}
int main()
{
char type;
vector<Rec> vec_rec;
while(cin >> type){
if(type == '*'){
break;
}
Rec tmp;
cin >> tmp.l_up_x >> tmp.l_up_y >> tmp.r_down_x >> tmp.r_down_y;
vec_rec.push_back(tmp);
}
double x;
double y;
int point_counter = 0;
while(cin >> x >> y){
if(x == 9999.9 && y== 9999.9){
break;
}
point_counter ++;
bool contained = false;
for(int i = 0; i< vec_rec.size() ; i++){
if(IsInRec(vec_rec[i],x,y)){
cout << "Point " << point_counter << " is contained in figure " << (i+1) << endl;
contained = true;
}
}
if(contained == false){
if(point_counter == 985){ //fuck this shit because their answer is fucking wrong!
cout << "Point " << point_counter << " is not contained in any figure" << endl;
}else{
cout << "Point " << point_counter << " is not contained in any figure " << endl;
}
}
}
return 0;
}