You are given a Directed Acyclic Graph (DAG) with vertices and edges. Each vertex has an integer, , associated with it and the initial value of is for all vertices. You must perform queries on the DAG, where each query is one of the following types:
1 u x: Set to for all such that there is a path in the DAG from to .
2 u x: Set to for all such that there is a path from to and .
3 u: Print the value of on a new line.
The first line contains three space-separated integers describing the respective values of (the number of vertices in the DAG), (the number of edges in the DAG), and (the number of queries to perform).
Each of the subsequent lines contains two space-separated integers describing the respective values of and (where , ) denoting a directed edge from vertex to vertex in the graph.
Each of the subsequent lines contains a query in one of the three formats described above.
It's guaranteed that the graph is acyclic, but there may be more than one edge connecting two nodes.
For each query of type (i.e., 3 u), print the value of on a new line.