This task is very simple. Given a string *S* of length *n* and *q* queries each query is on the format *i* *j* *k* which means sort the substring consisting of the characters from *i* to *j* in non-decreasing order if *k* = 1 or in non-increasing order if *k* = 0.

Output the final string after applying the queries.
The first line will contain two integers *n*, *q* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>, 0 ≤ *q* ≤ 50 000), the length of the string and the number of queries respectively. 

Next line contains a string *S* itself. It contains only lowercase English letters.

Next *q* lines will contain three integers each *i*, *j*, *k* (1 ≤ *i* ≤ *j* ≤ *n*, <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/187c38b0d200dfc5b5249f93c000f8dee9c1180d.png" style="max-width: 100.0%;max-height: 100.0%;"/>).
line=input()
n= int(line.split()[0])#num of letters
q= int(line.split()[1])#num of queries
string= input()

list=[]
for i in range(n):
    list.append(string[i])

#query i,j,k
for i in range(q):
    line1=input()
    substring= []
    i = int(line1.split()[0])
    j = int(line1.split()[1])
    k = int(line1.split()[2]) #k=1 non-decreasing k=0 non-increasing
    for l in range(i-1,j):
        substring.append(list[l])
    if k == 0 :
        substring.sort(reverse=True)
        #print(substring)
        #print(sorted(substring))
    if k == 1:
        substring.sort()
        #print(substring)
    list[i-1:j]=substring[0:(j-i+1)]

print(''.join(list))


