#434. Game on Plane

Game on Plane

Description

Alice and Bob are playing a game. In this game, there are nn straight lines on the 2D plane. Alice will select exactly kk straight lines l1,l2,,lkl_1,l_2,\dots,l_k among all the nn straight lines first, then Bob will draw a straight line LL. The penalty of Bob is defined as the number of lines in {l1,l2,,lk}\{l_1,l_2,\dots,l_k\} that shares at least one common point with LL. Note that two overlapping lines also share common points.

Alice wants to maximize the penalty of Bob while Bob wants to minimize it. You will be given these nn lines, please write a program to predict the penalty of Bob for k=1,2,3,,nk=1,2,3,\dots,n if both of the players play optimally.

Format

Input

The first line contains a single integer TT (1T5001 \leq T \leq 500), the number of test cases. For each test case:

The first line contains a single integer nn (1n1000001 \leq n \leq 100\,000), denoting the number of straight lines.

Each of the next nn lines contains four integers xai,yai,xbixa_i,ya_i,xb_i and ybiyb_i (0xai,yai,xbi,ybi109)0\leq xa_i,ya_i,xb_i,yb_i\leq 10^9), denoting a straight line passes both (xai,yai)(xa_i,ya_i) and (xbi,ybi)(xb_i,yb_i). (xai,yai)(xa_i,ya_i) will never be coincided with (xbi,ybi)(xb_i,yb_i).

It is guaranteed that the sum of all nn is at most 10000001\,000\,000.

Output

For each test case, output nn lines, the ii-th (1in1\leq i\leq n) of which containing an integer, denoting the penalty of Bob when k=ik=i.

Samples

2
2
1 1 2 2
0 0 2 3
3
1 1 2 2
1 1 2 2
3 2 5 4
0
1
0
0
0