Povjerenstvo
문제
Do you know how hard it is to choose a set of people for the problem selection committee? No? Well do you know who does? Mr. Malnar, of course. By observing human interactions, the all-knowing Mr. Malnar has decided what the ideal choice should look like.
A total of people are being considered for the committee and relations between them have been recorded. A relation is described by an ordered pair representing the fact that person dislikes person . Mr. Malnar defines a dislike circle to be a sequence of distinct people such that person dislikes person , for each 1 ≤ i ≤ k (it is assumed that ). Mr. Malnar noticed a peculiar property regarding the set of people in question: there is no dislike circle consisting of an odd number of people.
To minimize dissatisfaction with the choice of committee, Mr. Malnar is looking for a committee such that everyone within the committee agrees with each other and everyone outside of the committee is glad not to be in it. More precisely:
- There must not be two people within the committee such that one person dislikes the other.
- For each person outside the committee there should be someone in the committee who they dislike.
Can you find such a set of people?
입력
The first line contains positive integers and , the number of people and number of relations between them, respectively.
The -th of the following lines contains an ordered pair of positive integers and (1 ≤ a_i , b_i ≤ N), representing the fact that person dislikes the person . It holds that a_i ≠ b_i for all and no ordered pair is listed twice.
The given relations will be such that there is no dislike circle consisting of an odd number of people.
출력
If it is not possible to choose a set of people satisfying the given conditions, in the only line print -1.
Otherwise, in the first line print a positive integer (1 ≤ K ≤ N), the number of people in the committee. In the next line print distinct positive integers (1 ≤ p_i ≤ N), the indices of the people which make up the committee.
If there is more than one solution, output any one of them.
힌트
The set of chosen people is shown in the output of each test case.
The first example is a valid test case for the first subtask and for the second subtask.
The second example is not a valid test case for the first subtask, but it is valid for the second subtask.
The third example is not a valid test case for the first subtask nor for the second subtask.
예제
예제 1
4 4 1 2 1 3 2 4 3 4
2 4 1
예제 2
4 4 1 2 2 3 3 4 4 1
2 1 3
예제 3
8 11 1 2 2 1 3 4 4 5 5 6 6 3 7 8 8 7 3 2 7 3 8 1
3 1 3 5