| UDESC Selection Contest 2024-1 |
|---|
| Закончено |
Dudu is a great astronaut working for BRUTE — Brazilian Universal Technological Expeditions — and he has been given the difficult task of traveling to the planet "LK-4D4" to collect some precious rocks classified as "lango mocos."
After years in cryogenic sleep, Dudu finally arrived on this planet and began studying the lango mocos found there. After much research, he discovered that lango mocos contain chemical components never before seen by humans and that certain types of these rocks are toxic when in contact with certain other types.
He classified the lango mocos into $$$N$$$ types and wrote down $$$M$$$ pairs in his notebook. A pair $$$(u, v)$$$ written in Dudu's notebook means that lango moco type $$$u$$$ is toxic when in contact with lango moco type $$$v$$$ (and vice versa).
Fascinated by the lango mocos, Dudu decided he wants to bring all types of this precious rock back to Earth. Since the return trip is very long, Dudu must store the lango mocos in special bags that protect them from the dangers of space, and obviously, he doesn't want to place two lango mocos that are toxic to each other in the same bag. Each bag can hold an infinite quantity of lango mocos, as they are made from an expandable material developed by BRUTE.
More formally, if a bag contains types $$$a_1, a_2, \dots, a_k$$$, there must be no pair $$$(i, j)$$$ $$$(1 \le i, j \le k)$$$ such that $$$a_i$$$ is toxic to $$$a_j$$$.
Unfortunately, Dudu only has two special bags, and now he doesn't know how to separate the lango mocos.
To solve this problem, Dudu sent a message to you, one of BRUTE's best programmers, asking you to separate all the lango mocos into 2 bags, or tell him that the mission is impossible. If there is more than one way to make this separation, you can choose any of them.
The first line of input contains two integers $$$N$$$ $$$(1 \le N \le 10^5)$$$ and $$$M$$$ $$$(0 \le M \le \min(10^5, (N \cdot (N - 1)) / 2))$$$, the number of lango moco types and the number of pairs Dudu wrote down in his notebook.
The next $$$M$$$ lines each contain two integers $$$u$$$ and $$$v$$$, representing that lango moco type $$$u$$$ is toxic with lango moco type $$$v$$$ (and vice versa).
The first line of output must consist of the word "POSSIVEL" (without quotes) if it is possible to make the separation, or "IMPOSSIVEL" (without quotes) if it is impossible.
If the answer is possible, you must print 3 additional lines:
The first of these lines must contain two integers $$$K$$$ $$$(K \ge 0)$$$ and $$$H$$$ $$$(H \ge 0)$$$ such that $$$K + H = N$$$, representing the number of lango mocos in the first and second bags, respectively.
The second line must contain $$$K$$$ integers $$$a_1, \dots, a_K$$$, the types of lango mocos in the first bag.
The third line must contain $$$H$$$ integers $$$b_1, \dots, b_H$$$, the types of lango mocos in the second bag.
The lango mocos in each bag can be printed in any order.
2 11 2
POSSIVEL 1 1 1 2
1 0
POSSIVEL 1 0 1
6 51 22 33 14 55 6
IMPOSSIVEL
5 41 21 31 43 5
POSSIVEL 2 3 1 5 2 3 4
| Название |
|---|


