Easy Problem

아직 제출이 없습니다시간 제한3초메모리 제한1024 MB

문제

Askhat is a prospective businessman. He quickly figured that programming is an unprofitable business, so he decided to open a chicken farm.

His farm consists of nn chickens ordered in a row. The ii-th chicken can eat at most a_ia\_i grains. There are mm feeders, each described by integers l_jl\_j, r_jr\_j, c_jc\_j. The jj-th feeder can feed the ii-th chicken if l_jir_jl\_j \le i \le r\_j, and there are c_jc\_j grains in this feeder.

Turns out that every business has its own pitfalls, in this case it has the face of chicken feeding control, represented by Ildar. He claims that every respectable chicken farm must have a chicken representative. That is, there must exist a chicken ii such that l_jir_jl\_j \le i \le r\_j holds for every feeder jj. All feeders that don't obey this rule must be exterminated.

Now Askhat asks you to find, for each ii, what is the maximum number of grains that can be fed to chickens if we leave only feeders that can feed chicken ii.

입력

The first line contains a single integer tt (1t1041 \leq t \leq 10^4) --- the number of test cases. Description of test cases follows.

The first line of each test case contains two integers nn, mm (1n,m1051 \le n, m \le 10^5) --- the number of chickens and the number of feeders respectively.

The next line contains nn integers a_1,a_2,,a_na\_1, a\_2, \ldots, a\_n (0a_i1090 \le a\_i \le 10^9) --- the number of grains that chickens can eat.

Each of the next mm lines contains three integers l_jl\_j, r_jr\_j, c_jc\_j (1l_jr_jn1 \le l\_j \le r\_j \le n, 0c_j1090 \le c\_j \le 10^9) --- description of the jj-th feeder.

It is guaranteed that both the sum of nn and the sum of mm for all test cases do not exceed 10510^5.

출력

For each test case, print nn integers --- the answer to the problem.