eolymp
bolt
Try our new interface for solving problems
Problems

Ramsey theory

Ramsey theory

The map for "Among Us" is an undirected graph which vertices are rooms and the edges are two-way tunnels between them. The developer of this game, Ramsey, has a theory that a map must satisfy certain properties in order to be fun to play.

There will be k traitors and l ordinary crew members in the game. If there is a l-clique in the graph - a set of l vertices, each pair of which is connected by an edge - then the crew members will simply be distributed between them, and if one of them is killed, all players from neighboring rooms will immediately run, find the murderer and punish him. Such a game would be rather uninteresting.

On the other hand, if the graph has a k-anti-clique - a set of k vertices, each pair of which is not connected by an edge - then traitors will be able to stand at its vertices, lure good players and kill them there, and, most likely, they will manage to remain unnoticed. Such a strategy, according to Ramsey, will also make the game uninteresting.

Write a program that finds a l-clique or k-anti-clique in the graph or determines that they are not in the graph (and then the game promises to be exciting).

Input

The first line contains four numbers n, m, k, l (1n300 000, * 0* ≤ m300 000, 1k, l ≤ min(5, n)) - the number of vertices and edges of the graph, as well as the sizes of the required anti-cliques and cliques.

The next m lines contain two integers ai, bi (1ai < bin) - ends of the next edge of the graph. It is guaranteed that all edges are distinct.

Output

If you find a set of vertices that is either a k-anti-clique or an l-clique, print the numbers of all these vertices separated by a space. If there is no such set of vertices, print "-1".

Note

The first example looks like a pentagon in which all sides are drawn, but no diagonals are drawn. There are no triangles or anti-triangles in it, so the answer is "-1".

In the second and third examples, the graph is empty. The second example requires either finding an anti-edge or a 4-clique at the vertices. The answer will be any pair of different numbers from 1 to 4. In the third example, it's the other way around - you need to find either a 4-anti-clique or an edge. Since there are no edges, the only correct answer to this example is the set of all numbers from 1 to 4 (listed in no particular order).

In the fourth example, a complete graph is given, and the correct answer is any four of its vertices (because it will be its clique). However, a set of one vertex is always both a clique and an anti-clique; therefore, since it is allowed to output a 1-anti-clique in the example, any unimodal set is also a valid answer.

Time limit 1 second
Memory limit 128 MiB
Input example #1
5 5 3 3
1 2
2 3
3 4
4 5
1 5
Output example #1
-1
Input example #2
4 0 2 4
Output example #2
1 2
Input example #3
4 0 4 2
Output example #3
1 2 3 4
Input example #4
5 10 1 4
1 2
2 3
3 4
4 5
1 3
2 4
3 5
1 4
2 5
1 5
Output example #4
1
Source 2020 Cycle of Internet Olympiads for schoolchildren, Second team contest, October 25, Problem G