public static void main(String[] args) throws Throwable{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Point[]> rect = new ArrayList<Point[]>();
		StringBuffer sb = new StringBuffer();
		for (String ln; !(ln = in.readLine().trim()).equals("*");) {
			String[] arr = ln.split(" +");
			if(arr[0].equals("r"))
				rect.add(new Point[]{new Point(parseDouble(arr[1]), parseDouble(arr[2])), new Point(parseDouble(arr[3]), parseDouble(arr[4]))});
		}
		int cont = 0;
		while(true){
			String ln[] = in.readLine().trim().split(" +");
			Point p = new Point(parseDouble(ln[0]), parseDouble(ln[1]));
			if(p.x == 9999.9 && p.y == 9999.9)break;
			boolean ws = false;
			for (int i = 0; i < rect.size(); i++) 
				if(p.dentroRect(rect.get(i))){
					sb.append("Point " + (cont + 1) + " is contained in figure " + (i + 1) + "\n");
					ws = true;
				}
			if(!ws)sb.append("Point " + (cont + 1) + " is not contained in any figure\n");
			cont++;
		}
		System.out.print(new String(sb));
	}