Conan is trying to find the culprits among people, numbered from to .
Each person has two properties:
Truth-tellers always tell the truth, and liars always lie. There may be no culprits or multiple culprits. Person , being the cutest Mingu in the world, is always a truth-teller.
There are statements. Each statement is made by one person and has one of the following four types, denoted by .
Statement | |
|---|---|
"Person is not a culprit." | |
"Person is a culprit." |
An assignment of both properties to every person is called a state. A possible state is a state in which every statement is consistent with the nature of the person who made it. In other words, all statements made by truth-tellers must be true, and all statements made by liars must be false.
Find everyone who must be a culprit regardless of which possible state is chosen. That is, find all people who are culprits in every possible state.
The first line contains two space-separated integers and .
The -th of the next lines contains three space-separated integers , , and , describing the -th statement. Here, is the statement type, is the person making the statement, and is the person the statement is about.
If no possible state exists, print -1 on the first line.
Otherwise, print the numbers of all people who are culprits in every possible state, in ascending order, separated by spaces, on the first line. If there are no such people, print nothing.
"Person is a liar." |
"Person is a truth-teller." |
The input has the following format: