Problem: 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.

Input

The first line will contain two integers n, q (1 ≤ n ≤ 105, 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, <image>).

Output

Output one line, the string S after applying the queries.

Examples

Input

10 5
abacdabcda
7 10 0
5 8 1
1 4 0
3 6 0
7 10 1


Output

cbcaaaabdd

Input

10 1
agjucbvdfk
1 10 1


Output

abcdfgjkuv

Note

First sample test explanation:

<image>

<image>

<image>

<image>

<image>

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int n, m, i, j, x, y, tip, l, st, dr;
char s[100010];
vector<int> g[30];
vector<int>::iterator it;
int main() {
  scanf("%d %d %s", &n, &m, s + 1);
  for (i = 1; i <= n; i++) g[s[i] - 96].push_back(i);
  for (i = 1; i <= m; i++) {
    scanf("%d %d %d", &x, &y, &tip);
    if (tip == 0) {
      int k = x;
      for (int l = 26; l >= 1; l--) {
        int st = lower_bound(g[l].begin(), g[l].end(), x) - g[l].begin();
        int dr = upper_bound(g[l].begin(), g[l].end(), y) - g[l].begin();
        for (; st < dr; st++) {
          g[l][st] = k;
          k++;
        }
      }
    } else {
      int k = x;
      for (int l = 1; l <= 26; l++) {
        int st = lower_bound(g[l].begin(), g[l].end(), x) - g[l].begin();
        int dr = upper_bound(g[l].begin(), g[l].end(), y) - g[l].begin();
        for (; st < dr; st++) {
          g[l][st] = k;
          k++;
        }
      }
    }
  }
  for (i = 1; i <= 26; i++) {
    for (j = 0; j < g[i].size(); j++) s[g[i][j]] = char(i + 96);
  }
  puts(s + 1);
  return 0;
}