CF1239D Catowice City
Description
In the Catowice city next weekend the cat contest will be held. However, the jury members and the contestants haven't been selected yet. There are $ n $ residents and $ n $ cats in the Catowice, and each resident has exactly one cat living in his house. The residents and cats are numbered with integers from $ 1 $ to $ n $ , where the $ i $ -th cat is living in the house of $ i $ -th resident.
Each Catowice resident is in friendship with several cats, including the one living in his house. In order to conduct a contest, at least one jury member is needed and at least one cat contestant is needed. Of course, every jury member should know none of the contestants. For the contest to be successful, it's also needed that the number of jury members plus the number of contestants is equal to $ n $ .
Please help Catowice residents to select the jury and the contestants for the upcoming competition, or determine that it's impossible to do.
Input Format
N/A
Output Format
N/A
Explanation/Hint
In the first test case, we can select the first and the third resident as a jury. Both of them are not acquaintances with a second cat, so we can select it as a contestant.
In the second test case, we can select the second resident as a jury. He is not an acquaintances with a first and a third cat, so they can be selected as contestants.
In the third test case, the only resident is acquaintances with the only cat, so they can't be in the contest together. So it's not possible to make a contest with at least one jury and at least one cat.
In the fourth test case, each resident is acquaintances with every cat, so it's again not possible to make a contest with at least one jury and at least one cat.