There is an array of integers a=[a_1,a_2,\ldots,a_n] and an unknown permutation p=[p_1,p_2,\ldots,p_n] of the numbers from to .
There are people. Each person initially stands at some position from to , and the initial positions of all people are pairwise distinct.
Each person has a score , which is initially equal to .
During each day, the following actions happen to each person. Suppose that at the beginning of the day the person is at position :
their score is updated according to
after that, they move to position p_j.
For each person, their initial position and the value of their score after exactly days are known.
You need to find any permutation such that after exactly days the score of each person is equal to the given value.
If no such permutation exists, output .
The first line contains three integers , , and — the length of the array, the number of people, and the number of days, respectively.
The second line contains integers a_1,a_2,\ldots,a_n.
Each of the next lines contains two integers s_i and c_i — the initial position of the -th person and the value of their score after exactly days, respectively.
All values s_i are pairwise distinct.
If there is no permutation satisfying all the given conditions, output .
Otherwise, output integers
— any permutation of the numbers from to that satisfies all the given conditions.
Example 1
Example 2
In the first example, one can choose the permutation
The first person starts at position . During three days, they will be at positions , so their final score will be
The second person starts at position . During three days, they will be at positions , so their final score will be
Thus, the given permutation satisfies all the conditions.
In the second example, the only person starts at position , where a_1=2. After the first day already, their score will become at least , but the given final score is . Therefore, no suitable permutation exists, and the answer is .
Subtask ( points): all values a_i are equal.
Subtask ( points): x = n.
Subtask ( points): a_i \le 20 for all 1 \le i \le n.
Subtask ( points): No additional constraints.