#arc111d. [arc111_d]Orientation
[arc111_d]Orientation
Problem Statement
Given is a simple undirected graph with vertices and edges. The vertices are numbered , and the -th edge connects Vertices and . Also given is a sequence of positive integers: .
Convert this graph into a directed graph that satisfies the condition below, that is, for each , delete the undirected edge and add one of the two direted edges and .
- For every , there are exactly vertices reachable from Vertex (by traversing some number of directed edges), including Vertex itself.
In this problem, it is guaranteed that the given input always has a solution.
Constraints
- The given graph has no self-loops and no multi-edges.
- There always exists a valid solution.
Input
Input is given from Standard Input in the following format:
Output
Print lines.
To add the edge for the -th edge, print ->
in the -th line; to add the edge for the -th edge, print <-
.
If there are multiple solutions, any of them will be accepted.
Sample Input 1
3 3
1 2
2 3
3 1
3 3 3
Sample Output 1
->
->
->
In a cycle of length , you can reach every vertex from any vertex.
Sample Input 2
3 2
1 2
2 3
1 2 3
Sample Output 2
<-
<-
Sample Input 3
6 3
1 2
4 3
5 6
1 2 1 2 2 1
Sample Output 3
<-
->
->
The graph may be disconnected.