

Segment setTime Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6487 Accepted Submission(s): 2460 Problem Description A segment and all segments which are connected with it compose a segment set. The size of a segment set is the number of segments in it. The problem is to find the size of some segment set. Input In the first line there is an integer t  the number of test case. For each test case in first line there is an integer n (n<=1000)  the number of commands. There are two different commands described in different format shown below: P x1 y1 x2 y2  paint a segment whose coordinates of the two endpoints are (x1,y1),(x2,y2). Q k  query the size of the segment set which contains the kth segment. k is between 1 and the number of segments in the moment. There is no segment in the plane at first, so the first command is always a Pcommand. Output For each Qcommand, output the answer. There is a blank line between test cases. Sample Input
Sample Output
Author LL Source  
