using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); static int[][] NArr(long n) => Enumerable.Repeat(0, (int)n).Select(_ => NList).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, q) = (c[0], c[1]); var s = ReadLine(); var query = NArr(q); var cum = new int[n + 1][]; cum[0] = new int[26]; for (var i = 0; i < n; ++i) { cum[i + 1] = (int[]) cum[i].Clone(); ++cum[i + 1][s[i] - 'a']; } var ans = new char[q]; for (var i = 0; i < q; ++i) { var sub = 0; for (var j = 0; j < 26; ++j) { sub += cum[query[i][1]][j] - cum[query[i][0] - 1][j]; if (sub >= query[i][2]) { ans[i] = (char)(j + 'a'); break; } } } WriteLine(string.Join("\n", ans)); } }