Олимпиадный тренинг

Задача 21710. cross ribs


Задача

Темы:
A connected oriented unweighted graph is given. It is required to print the numbers of vertices from which all its cross edges emanate (numbering starting from 1).
 
Input:
Integer n and m - the number of vertices and edges in the graph.
The next m lines contain 2 numbers a and b showing that there is an edge from vertex a to vertex b.
 
Output:
The first line should contain the number n - the number of cross edges, the next line should contain the vertices in ascending order without repetition. If there are none, then output -1.