import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.PrintWriter; public class Main { public static void main(String[] args) throws Exception { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] sa = br.readLine().split(" "); int n = Integer.parseInt(sa[0]); int q = Integer.parseInt(sa[1]); char[] s = br.readLine().toCharArray(); int[] l = new int[q]; int[] r = new int[q]; int[] x = new int[q]; for (int i = 0; i < q; i++) { sa = br.readLine().split(" "); l[i] = Integer.parseInt(sa[0]) - 1; r[i] = Integer.parseInt(sa[1]); x[i] = Integer.parseInt(sa[2]); } br.close(); int[][] c = new int[26][n + 1]; for (int i = 0; i < 26; i++) { for (int j = 0; j < n; j++) { c[i][j + 1] = c[i][j]; if (s[j] - 'a' == i) { c[i][j + 1]++; } } } PrintWriter pw = new PrintWriter(System.out); for (int i = 0; i < q; i++) { int sum = 0; for (int j = 0; j < 26; j++) { int d = c[j][r[i]] - c[j][l[i]]; sum += d; if (sum >= x[i]) { pw.println((char) ('a' + j)); break; } } } pw.flush(); } }