PROGRAMMING:Judgment loop
There are n items (1 < = n < = 1000), numbered 1, 2, 3... N. now we only know the relationship between M and items, (P1, P2), that is, P1 is heavier than P2, which is represented by P1 and P2. When sorting, P1 is before P2. Now please program to confirm the order【 Test case: IOT engineering level 16 [fan Yiming]
###Input format:
There are several groups of input, the first line in each group has two numbers n (1 < = n < = 500), m; Where n is the number of teams and M is the input data of M lines. In the next M rows of data, each row also has two integers P1. P2 means that P1 is heavier than P2. If there are such relations as (1,4), (4,2), (2,1), then - 1 is output;
###Output format:
Give a ranking that meets the requirements. When outputting, there are spaces between item numbers, and no spaces after the last one.
###Input example:
Here is a set of inputs. For example:
```in
2 2
2 1
1 2
```
###Output example:
The corresponding output is given here. For example:
```out
-1
```
answer:If there is no answer, please comment
###Input format:
There are several groups of input, the first line in each group has two numbers n (1 < = n < = 500), m; Where n is the number of teams and M is the input data of M lines. In the next M rows of data, each row also has two integers P1. P2 means that P1 is heavier than P2. If there are such relations as (1,4), (4,2), (2,1), then - 1 is output;
###Output format:
Give a ranking that meets the requirements. When outputting, there are spaces between item numbers, and no spaces after the last one.
###Input example:
Here is a set of inputs. For example:
```in
2 2
2 1
1 2
```
###Output example:
The corresponding output is given here. For example:
```out
-1
```
answer:If there is no answer, please comment