#P1146E. Hot is Cold

    ID: 2606 Type: RemoteJudge 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>bitmasksdata structuresdivide and conquerimplementation*2400

Hot is Cold

No submission language available for this problem.

Description

You are given an array of nn integers a1,a2,,ana_1, a_2, \ldots, a_n.

You will perform qq operations. In the ii-th operation, you have a symbol sis_i which is either "<" or ">" and a number xix_i.

You make a new array bb such that bj=ajb_j = -a_j if ajsixia_j s_i x_i and bj=ajb_j = a_j otherwise (i.e. if sis_i is '>', then all aj>xia_j > x_i will be flipped). After doing all these replacements, aa is set to be bb.

You want to know what your final array looks like after all operations.

The first line contains two integers n,qn,q (1n,q1051 \leq n,q \leq 10^5) — the number of integers and the number of queries.

The next line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (105ai105-10^5 \leq a_i \leq 10^5) — the numbers.

Each of the next qq lines contains a character and an integer si,xis_i, x_i. (si{<,>},105xi105s_i \in \{<, >\}, -10^5 \leq x_i \leq 10^5) – the queries.

Print nn integers c1,c2,,cnc_1, c_2, \ldots, c_n representing the array after all operations.

Input

The first line contains two integers n,qn,q (1n,q1051 \leq n,q \leq 10^5) — the number of integers and the number of queries.

The next line contains nn integers a1,a2,,ana_1, a_2, \ldots, a_n (105ai105-10^5 \leq a_i \leq 10^5) — the numbers.

Each of the next qq lines contains a character and an integer si,xis_i, x_i. (si{<,>},105xi105s_i \in \{<, >\}, -10^5 \leq x_i \leq 10^5) – the queries.

Output

Print nn integers c1,c2,,cnc_1, c_2, \ldots, c_n representing the array after all operations.

Samples

Sample Input 1

11 3
-5 -4 -3 -2 -1 0 1 2 3 4 5
&gt; 2
&gt; -4
&lt; 5

Sample Output 1

5 4 -3 -2 -1 0 1 2 -3 4 5

Sample Input 2

5 5
0 1 -2 -1 2
&lt; -2
&lt; -1
&lt; 0
&lt; 1
&lt; 2

Sample Output 2

0 -1 2 -1 2

Note

In the first example, the array goes through the following changes:

  • Initial: [5,4,3,2,1,0,1,2,3,4,5][-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
  • >2> 2: [5,4,3,2,1,0,1,2,3,4,5][-5, -4, -3, -2, -1, 0, 1, 2, -3, -4, -5]
  • >4> -4: [5,4,3,2,1,0,1,2,3,4,5][-5, -4, 3, 2, 1, 0, -1, -2, 3, -4, -5]
  • <5< 5: [5,4,3,2,1,0,1,2,3,4,5][5, 4, -3, -2, -1, 0, 1, 2, -3, 4, 5]