#include <stdio.h>
#include <math.h>

#define FMAX 11

const double EPS = 1.0e-10;

int cmp(double x, double y) {
	if (fabs(x-y)<EPS) {
		return 0;
	} else if (x>y) {
		return 1;
	} else {
		return -1;
	}
}

struct ponto {
	double x;
	double y;
};

struct retangulo {
	struct ponto a;
	struct ponto b;
};

struct circulo {
	struct ponto centro;
	double raio;
};

int main() {
	struct retangulo ret[FMAX];
	struct circulo cir[FMAX];
	struct ponto vetorDiferenca;
	struct ponto pt;
	double x1, x2, y1, y2;
	double diferenca;
	int i;
	int numeroFormas;
	int numeroPonto=1;
	int cumpriu;
	char tipo[FMAX];
	int nf;
	
	for (i=0; scanf(" %c", &tipo[i])&&(tipo[i]=='r'||tipo[i]=='c'); i++) {
		if (tipo[i]=='r') {
			scanf("%lf %lf %lf %lf", &x1, &y1, &x2, &y2);
			if (x1<x2) {
				ret[i].a.x=x1;
				ret[i].b.x=x2;
			} else {
				ret[i].a.x=x2;
				ret[i].b.x=x1;
			}
			if (y1<y2) {
				ret[i].a.y=y1;
				ret[i].b.y=y2;
			} else {
				ret[i].a.y=y2;
				ret[i].b.y=y1;
			}
		} else if (tipo[i]=='c') {
			scanf("%lf %lf %lf", &cir[i].centro.x, &cir[i].centro.y, &cir[i].raio);
		}
	}
	numeroFormas=i;

	while (scanf("%lf %lf", &pt.x, &pt.y)&&(cmp(pt.x, 9999.9)!=0||cmp(pt.y, 9999.9)!=0)) {
		cumpriu=0;
		for (i=0; i<numeroFormas; i++) {
			nf=i+1;
			if (tipo[i]=='r') {
				if (cmp(ret[i].a.x, pt.x)<0&&cmp(pt.x, ret[i].b.x)<0 &&
				    cmp(ret[i].a.y, pt.y)<0&&cmp(pt.y, ret[i].b.y)<0) {
					cumpriu=1;
					printf("Point %d is contained in figure %d\n", numeroPonto, nf);
				}
			} else if (tipo[i]=='c') {
				vetorDiferenca.x=fabs(pt.x-cir[i].centro.x);
				vetorDiferenca.y=fabs(pt.y-cir[i].centro.y);
				diferenca=sqrt(pow(vetorDiferenca.x, 2)+pow(vetorDiferenca.y, 2));
				if (diferenca<cir[i].raio) {
					cumpriu=1;
					printf("Point %d is contained in figure %d\n", numeroPonto, nf);
				}
			}
		}
		if (cumpriu==0) {
			printf("Point %d is not contained in any figure\n", numeroPonto);
		}
		numeroPonto++;
	}

	return 0;
}

