| Good Bye 2025 |
|---|
| Finished |
Due to supply chain issues in the North Pole (allegedly caused by a lazy elf), Santa is planning to give out hand-drawn circles as presents this Christmas. Please help him decorate them!
There are $$$2n$$$ equally spaced points around the circle, labeled $$$1,2,\ldots,2n$$$ in clockwise order. Santa has chosen $$$n$$$ chords with distinct endpoints, where chord $$$i$$$ connects the points $$$a_i$$$ and $$$b_i$$$. He draws these chords onto the circle one by one, in order.
After Santa has drawn the first $$$\ell$$$ chords, consider any non-empty subset $$$S$$$ of the $$$\ell$$$ chords and let $$$1\leq c_1 \lt c_2 \lt \cdots \lt c_{|S|}\leq \ell$$$ be their indices. $$$S$$$ is defined to be a chain if and only if chord $$$c_k$$$ intersects chord $$$c_{k+1}$$$ for all $$$1\leq k \lt |S|$$$. Note that $$$S$$$ is always a chain if $$$|S|=1$$$.
Santa does not want any chord to be the odd one out. Therefore, he considers the chords to be tight-knit if and only if every chord appears in an even number of chains, taken over all chains that are subsets of the first $$$\ell$$$ chords.
For each $$$\ell$$$ from $$$1$$$ to $$$n$$$, help Santa determine whether his chords are tight-knit.
Each test contains multiple test cases. The first line contains the number of test cases $$$t$$$ ($$$1 \le t \le 10^4$$$). The description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$2\le n\le 5\cdot 10^5$$$) — the number of chords.
Then $$$n$$$ lines follow, the $$$i$$$-th line containing two integers $$$a_i$$$ and $$$b_i$$$ ($$$1\le a_i \lt b_i\le 2n$$$) — the endpoints of the $$$i$$$-th chord.
It is guaranteed that all endpoints are distinct.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$5\cdot 10^5$$$.
For each test case, output a string of length $$$n$$$ — the $$$\ell$$$-th character should be $$$\texttt{1}$$$ if the first $$$\ell$$$ chords are tight-knit and $$$\texttt{0}$$$ otherwise.
331 62 34 541 73 84 62 551 64 92 75 103 8
000010001111
In the first test case, no pairs of chords intersect, and thus every chord appears in exactly one chain consisting of itself. Therefore, the chords are not tight-knit for all $$$\ell$$$.
In the second test case, below is an illustration and explanation after the first $$$\ell=1,2,3,4$$$ chords are drawn. Sets of chords are denoted as a set of the indices of the corresponding chords.
| Illustration | |
Chains
| ![]() |
Chains
| ![]() |
Chains
| ![]() |
Chains
| ![]() |
Thus, we output $$$\mathtt{0100}$$$.
| Name |
|---|


