Acrobat Reader
Time limit1sMemory limit128 MB
For each test case, decide whether two sets of N points match under rotation by a multiple of 90 degrees, translation, and positive uniform scaling, with reflections disallowed.
Problem
At an airport, biometric data is used to confirm that travelers are who they claim to be. A circus troupe touring abroad next month expects trouble at border control: when its acrobats face the camera, there is no telling which way their face will be oriented. You may assume that every acrobat looks straight into the camera, but the recorded face may be rotated by a multiple of 90 degrees. As with any passenger, the picture may also be translated and uniformly scaled (by the same factor along both axes).
You are given several pairs of biometric scans; each pair consists of one scan taken from the passport and one recorded live. For every acrobat, decide whether the two scans match.
Two scans match when one can be turned into the other using a rotation of , , , or , a translation, and a positive uniform scaling. Reflections (mirror images) are not allowed.
Input
The first line contains a single integer: the number of test cases.
Each test case has the following format.
- One line with an integer (): the number of points in each of the acrobat's two scans.
- lines, each with two integers and (): a point of the first scan (from the passport).
- lines, each with two integers and (): a point of the second scan (recorded live).
The two integers on a line are separated by a single space. Within one scan no two points are identical, and the points are listed in arbitrary order.
Output
For each test case, print a single line: okay if the two scans match, or mismatch! if they do not.