QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#6270. Selecting Graphs

Statistics

Given an undirected simple graph with $kn$ vertices, it is guaranteed that the degree of each vertex is less than $kd$.

Find a subset of $n$ vertices such that the degree of each vertex in the induced subgraph is less than $d$.

Input

The first line contains four positive integers $k, n, d, m$.

The next $m$ lines each contain two positive integers $u, v$, representing an edge.

Output

Output $n$ distinct integers between $1$ and $kn$, representing the selected set of vertices.

Examples

Input 1

2 3 2 9
1 2
2 3
3 1
4 5
5 6
6 4
1 4
2 5
3 6

Output 1

3 4 5

Note

For $100\%$ of the data, it is guaranteed that $2\leq k\leq 10$, $1\leq d\leq 10$, $1\leq n\leq 10^3$, and $m\leq \frac{k(k-1)}2dn$.

For data points $1\sim 2$, $kn\leq 20$.

For data points $3\sim 5$, $d=1$.

For data points $6\sim 8$, $k=2$.

For data points $9\sim 10$, there are no special restrictions.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.