Thinking Inside the Box

Time limit1sMemory limit128 MB

Problem

Data Co is having trouble organizing its vast collection of survey data. It has dozens of survey datasets that span large portions of the globe. Each survey's coverage is stored as a bounding box, so that anyone curious about a specific region can enter coordinates to retrieve the matching data. Your job is to find, for each user query, which stored survey boxes are involved.

Input

The first line contains an integer $T$, the number of test cases. Each test case consists of two lists of bounding boxes.

  • The first list holds the bounding boxes stored in the system (the Data Boxes).
  • The second list holds the bounding boxes that represent user queries (the Query Boxes).

Each list is preceded by a line containing the number of boxes in that list. A bounding box is written on one line as two Latitude/Longitude points separated by a single space.

lat1,lon1 lat2,lon2

The first point is a top corner of the box and the second point is the opposite corner. Latitudes and longitudes are given in degrees.

Output

For each test case, print every Data Box that is touched in any way by at least one Query Box. Two boxes that share only a border or a single corner are still considered touching. Print each touched Data Box exactly once, using the same coordinates as in the input and in the order the Data Boxes were given. If several Query Boxes touch the same Data Box, print that Data Box only once.

If no Data Box is touched by any Query Box in a test case, print No data found. instead.

Separate the output of consecutive test cases with a single blank line.

Notes

Latitude and longitude are angular measurements. Lines of latitude are the horizontal lines on the globe: the Equator is at latitude 0, the North Pole at 90, and the South Pole at -90. Lines of longitude (meridians) run vertically between the poles. The Prime Meridian is at longitude 0; longitude increases going east and decreases going west, wrapping around at ±180 (so 180 and -180 denote the same meridian).

A box's latitude range never wraps over a pole. A box's longitude range, however, may wrap around the antimeridian at ±180: it always runs eastward from the first point's longitude to the second point's longitude. For example, a box whose points have longitudes 170 and -160 covers the longitudes from 170 eastward across ±180 to -160.