#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;
};

double produtoVetorial(struct ponto u, struct ponto v) {
//	printf("%Lf %Lf %Lf %Lf\n", u.x, v.y, u.y, v.x);
	return (u.x*v.y)-(u.y*v.x);
}

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

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

struct triangulo {
	struct ponto a;
	struct ponto b;
	struct ponto c;
};

int main() {
	struct retangulo ret[FMAX];
	struct circulo cir[FMAX];
	struct triangulo tri[FMAX];
	struct ponto vetorDiferenca;
	struct ponto pt;
	struct ponto ap, ab, bp, bc, cp, ca;
	double x1, x2, x3, y1, y2, y3;
	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]!='*'; 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);
		} else if (tipo[i]=='t') {
			scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3);
			tri[i].a.x=x1;
			tri[i].a.y=y1;
			tri[i].b.x=x2;
			tri[i].b.y=y2;
			tri[i].c.x=x3;
			tri[i].c.y=y3;
		}
	}
	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);
				}
			} else if (tipo[i]=='t') {
				ap.x=pt.x-tri[i].a.x;
				ap.y=pt.y-tri[i].a.y;
				ab.x=tri[i].b.x-tri[i].a.x;
				ab.y=tri[i].b.y-tri[i].a.y;
				bp.x=pt.x-tri[i].b.x;
				bp.y=pt.y-tri[i].b.y;
				bc.x=tri[i].c.x-tri[i].b.x;
				bc.y=tri[i].c.y-tri[i].b.y;
				cp.x=pt.x-tri[i].c.x;
				cp.y=pt.y-tri[i].c.y;
				ca.x=tri[i].a.x-tri[i].c.x;
				ca.y=tri[i].a.y-tri[i].c.y;
/*				printf("\n*** %d ***\n", i);
				printf("ap = (%lf, %lf)\n", ap.x, ap.y);
				printf("ab = (%lf, %lf)\n", ab.x, ab.y);
				printf("bp = (%lf, %lf)\n", bp.x, bp.y);
				printf("bc = (%lf, %lf)\n", bc.x, bc.y);
				printf("cp = (%lf, %lf)\n", cp.x, cp.y);
				printf("ca = (%lf, %lf)\n", ca.x, ca.y);*/
				if ((produtoVetorial(ap, ab)<0 &&
				     produtoVetorial(bp, bc)<0 &&
				     produtoVetorial(cp, ca)<0) ||
				    (produtoVetorial(ap, ab)>0 &&
				     produtoVetorial(bp, bc)>0 &&
				     produtoVetorial(cp, ca)>0)) {
					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;
}

