Old Orhei (Orheiul Vechi) is a natural and historical complex located on a narrow bend of the Răut River. It consists of $N$ archaeological vestiges and $M$ one-way roads between some pairs of vestiges. Every road has a unique index between $1$ and $M$, defined by the input order in which it is given. Please refer to the Examples section for visualizing such a configuration.
Recently an array left by the Cucuteni–Trypillia civilization was discovered by the local scientists. The array consists of $T$ integers with values between $1$ and $M$. In order to figure out the mystical meaning of this array, the new intern will be instructed to follow this procedure:
At the beginning, the intern starts at some initial archaeological vestige. The other scientists start broadcasting to him a contiguous sub-array of the main array (first broadcasting the first element of the subarray, then the second one, and so on). The intern then changes his location depending on the following rules:
With the occasion of the $8$-th European Junior Olympiad in Informatics, the local scientists have asked you to help them perform the following $Q$ queries:
Your task is to answer correctly to all the queries of type $1$.
The first line contains two space-separated integers $N$ and $M$, the number of archaeological vestiges and one-way roads.
The next $M$ lines contain the description of the roads. In particular, line i will contain two space-separated numbers indicating that the $i$-th road starts in $X_i$ and ends in $Y_i$. There can exist roads for which $X_i = Y_i$ as well as pairs of roads for which $X_i = X_j$ , $Y_i = Y_j$ but $i \ne j$.
The next line contains an integer $T$, the length of the found array.
The next line contains $T$ space-separated integers $A_1 ,A_2, \dots ,A_T$, representing the array elements.
The next line contains an integer $Q$, the number of queries.
The next $Q$ lines contain the query description:
For each query of type $1$ output the answer on a separate line.