Shuttle Bus

No attempts yetTime limit1sMemory limit128 MB

Problem

Hyoseong's school is starting a shuttle bus between the school and the bus terminal for students who commute from far away. The schedule was set exactly as the students asked for it. Given that schedule, find the smallest number of buses that can run all of it.

One trip takes DD minutes in either direction. Boarding and getting off take no time, so a bus that reaches a place at time tt can take a trip that leaves that place at time tt. At the start of the day each bus may be parked at the school or at the terminal.

Input

The first line has the number of test cases TT (1T101 \le T \le 10).

The first line of each test case has the travel time DD (1D1201 \le D \le 120) between the school and the terminal, in minutes. The next line has AA (1A201 \le A \le 20), the number of trips that leave the school for the terminal, and the following AA lines each hold one departure time in HH:MM format, in chronological order. The next line has BB (1B201 \le B \le 20), the number of trips that leave the terminal for the school, and the following BB lines each hold one departure time in HH:MM format, in chronological order.

Every time lies between 06:00 and 21:00, and HH and MM always have two digits. A single digit is padded with a leading zero. When several trips leave the same place at the same time, a different bus has to take each of them.

Output

For each test case print the minimum number of buses needed to run the whole schedule, one per line.