Beehive Epidemic
Time limit2sMemory limit256 MB
On a hexagonal grid, assign bees to distinct safe zones they reach before the spreading bacteria to save as many as possible.
Problem

The bee flu is running through the hives. To keep the colony alive, the bees of Inner Dreaded Illnessia keep a few cells of the hive free as safe zones. A bee that gets into a safe zone before the bacteria do survives the outbreak. The honey needs room too, so there are far fewer safe zones than bees and the bees have to share them out. Work out how many of them can be saved.
The hive is a hexagonal grid. Every cell has a coordinate , and cell touches the six cells , , , , and . The picture shows how the coordinates run. The hive is so large that no bee ever reaches its border.
- Once every second a bee moves to a neighbouring cell or stays where it is. It reaches a cell at hex distance after seconds.
- The bacteria hold their starting cells from the beginning and spread once every two seconds. The first spread happens right after second 2, the second one right after second 4, and so on. After the -th spread the bacteria hold every cell within hex distance of a starting cell.
- Safe zones never move. A bee is saved when it enters a safe zone the bacteria have not reached yet and stays there. The bees make two moves before the first spread, so a bee that arrives at second in a zone the bacteria reach with their -th spread is still in time.
- A bee that stands in a safe zone at second 0 is not saved yet, because it is not hiding just in case. Its earliest safe moment is second 1, after one move, and staying in place counts as a move.
- Only one bee is saved in each safe zone. Anywhere else the bees ignore each other, and any number of them may sit in the same cell while they travel.
- Only the arrival at a safe zone counts. A travelling bee is never blocked or infected on the way.
Input
The first line contains the number of test cases . Each test case consists of four lines. The first line holds , and : the number of bees, of safe zones and of bacteria colonies. The second line holds , the cells where the bees start. The third line holds the safe zones in the same format, and the fourth line the cells where the bacteria start.
- No two safe zones share a cell. Any other cell may repeat: several bees may start together, several bacteria colonies may share a cell, and a bee may start in a safe zone or on a bacteria cell.
Output
For each test case, print one line with the largest number of bees that can be saved.