Jewelry Exhibition
Time limit1sMemory limit256 MB
You choose the fewest unit-wide horizontal or vertical strips on integer lines to cover every exhibit point.
Problem
To guard an art jewelry exhibition at night, a security agency installed a new laser beam system built from sender and receiver pairs. Each pair produces a strip of light of unit width and guards every object inside that strip. For each exhibition room, compute the minimum number of sender and receiver pairs that is enough to protect every exhibit in the room.
A room is a rectangle, so it is described as the rectangle in the plane. The objects to guard are points inside that rectangle. A sender is mounted on one wall and the matching receiver on the opposite wall, so the strip it produces is a rectangle of unit width whose length is either or . The system is still not perfect, so the corners of every strip must have integer coordinates. A pair also protects only the items inside its strip, not the ones lying on its border. For that reason the agency arranged the exhibits so that both coordinates of every exhibit point are non-integers.
The figure below shows, on the left, eight items arranged in a room. Up to eight sender and receiver pairs can be mounted in that room. The picture on the right shows the area three pairs protect.

Input
The first line contains the number of exhibition rooms , where .
The descriptions of the rooms follow. Each description starts with a single line holding three integers , and . The values and give the size of the room, with and . The value is the number of exhibits, with . The next lines each contain two real numbers and , the coordinates of one exhibit. It holds that and , and neither nor is an integer.
Output
For every room print one line with one integer, the minimum number of sender and receiver pairs that is enough to protect every exhibit in that room.