## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] Segmentation Fault CodeChef Solution

There are $N$ people numbered from $1$ to $N$ such that:

• Exactly one of these people is a thief and always lies;
• All the others are honest and always tell the truth.

If the ${i}^{th}$ person claims that the thief is one person out of ${L}_{i},{L}_{i}+1,{L}_{i}+2,\cdots ,{R}_{i}$, determine how many people could be the thief.

It is guaranteed that at least one person can be the thief.

### Input Format

• First line will contain $T$, the number of test cases. Then the test cases follow.
Solution Click Below:-  👉
👇👇👇👇👇

• First line of each test case will contain $N$, the number of people. $N$ lines follow.
• The ${i}^{th}$ line contains two space-separated integers - ${L}_{i}$ and ${R}_{i}$, the range of people amongst which the ${i}^{th}$ person claims the thief is.

### Output Format

• For each test case, in the first line, output $K$, the number of possible thieves.

• In the next $K$ lines, output the list of people that could be the thieves, in ascending order.

### Constraints

• $1\le T\le {10}^{5}$
• $3\le N\le {10}^{5}$
• $1\le {L}_{i}\le {R}_{i}\le N$
• Sum of $N$ over all test cases does not exceed ${10}^{5}$.
• It is guaranteed that at least one person can be the thief.