Recently, Rikka showed great interest in the data structures for directed acyclic graphs (DAGs). She dreams that extending classic tree-based algorithms like "weighted-chain decomposition" to their counterparts based on DAGs will be perfectly cooooool!
Now, she came up with a simple problem, and she would like to invite you to solve this problem with her.
You are given an n-node m-edge DAG G. Each node u has a non-negative integer value val_u. All values are set to 0 initially.
Rikka wants to perform q operations of three types described below:
Can you perform all these operations fast enough?
A node v is said to be reachable from u if there is a path starting in u and ending in v. A path is a node sequence p_1,p_2,…,p_k satisfying (p_i,p_i+1)∈G for each i=1,2,…,k−1.
The first line of input contains three integers n, m, q (1≤n,m,q≤105).
Then m lines follow. Each of them contains two integers x and y, representing a directed edge (x,y) in the graph (1≤x,y≤n). The input graph is guaranteed to be a DAG.
Then q lines follow. Each of them contains two or three integers in one of the following three formats:
1 u x" indicating the first type of operation;2 u x" indicating the second type of operation;3 u" indicating the third type of operation.All parameters in the operations above satisfy 1≤u≤n and 0≤x≤109.
For each operation of the third type, print a single line containing an integer: the current value of val_u.