Graph Orientation#2800

Graph Orientation

1 second
256 megabytes
Medium

An undirected graph with vertices, numbered from to , is given. Write a program that sequentially solves the following tasks:

Input

The input file contains an integer (1 \leq N \leq 100) and a list of the edges of the graph, given by their terminal vertex numbers.

Output

Your program should output the answers to points a)–e) in the following format:

  • On the first line, output the answer to part a).

  • On the second line, output the number of edges from part b), followed by the list of these edges on the next lines.

  • On the next line, output "NOT POSSIBLE" if it is not possible to orient the graph as described in part c); otherwise, output "POSSIBLE".

  • Then, output the number of graph edges that can be oriented as in part d); on the following lines, print these edges with their orientation (first the starting vertex, then the ending vertex).

  • For part e), output the number of edges that should be added to the original graph, followed by the list of these edges.

Edges are specified by the numbers of their terminal vertices, and for the answer to part d), their orientation must be shown (first the starting vertex, then the ending vertex).

If the answer to part a) is not one, you should not solve or output the answers for parts c) and d).

Points are awarded only if the program correctly outputs the answers to all the tasks.

Examples

Example 1

Loading
Loading