#include <bits/stdc++.h>
const unsigned long long CP1 = (unsigned long long)0xFFFDE001;
const unsigned long long CP2 = (unsigned long long)0xFFF88001;
unsigned int base[1000000];
unsigned int hash[27][400007];
void iniBKDR(unsigned long long B, long size) {
  unsigned long long t1, t2;
  long i;
  base[0] = B;
  t1 = 1;
  t2 = 1;
  for (i = 2; i <= 2 * size; i += 2) {
    t1 = t1 * (*base) % CP1;
    t2 = t2 * (*base) % CP2;
    base[i] = t1;
    base[i + 1] = t2;
  }
}
void BKDR(char *str, long l, long r, unsigned int *hash) {
  unsigned long long t1, t2;
  long i;
  *hash = 0;
  t1 = hash[2 * l - 2];
  t2 = hash[2 * l - 1];
  for (i = l; i <= r; i++) {
    t1 = (t1 * (*base) + (str[i])) % CP1;
    t2 = (t2 * (*base) + (str[i])) % CP2;
    hash[2 * i] = t1;
    hash[2 * i + 1] = t2;
  }
}
static inline unsigned long long bkdr(unsigned int *hash, long l, long r) {
  unsigned long long t1, t2, t;
  t1 = (unsigned long long)hash[2 * l - 2] * base[2 * r - 2 * l + 2] % CP1;
  t = hash[2 * r];
  t1 = (t1 < t) ? (t - t1) : (t - t1 + CP1);
  t2 = (unsigned long long)hash[2 * l - 1] * base[2 * r - 2 * l + 3] % CP2;
  t = hash[2 * r + 1];
  t2 = (t2 < t) ? (t - t2) : (t - t2 + CP2);
  return (t1 << 32) | t2;
}
char str[1000000];
char str2[1000000];
unsigned long long num1[100];
unsigned long long num2[100];
int main() {
  long long a, b, c, n, m, i, j, k, ans;
  char ch;
  scanf("%lld%lld", &n, &m);
  for (i = 1; i <= n; i++) {
  RE:
    scanf("%c", &ch);
    if (islower(ch) == 0) {
      goto RE;
    }
    str[i] = ch - 'a' + 1;
  }
  iniBKDR(131, n);
  for (i = 1; i <= 26; i++) {
    for (j = 1; j <= n; j++) {
      str2[j] = (str[j] == i);
    }
    BKDR(str2, 1, n, hash[i]);
  }
  for (i = 1; i <= m; i++) {
    scanf("%lld%lld%lld", &a, &b, &c);
    for (j = 1; j <= 26; j++) {
      num1[j] = bkdr(hash[j], a, a + c - 1);
      num2[j] = bkdr(hash[j], b, b + c - 1);
    }
    std::sort(num1 + 1, num1 + 27);
    std::sort(num2 + 1, num2 + 27);
    ans = 1;
    for (j = 1; j <= 26; j++) {
      if (num1[j] != num2[j]) {
        ans = 0;
        break;
      }
    }
    if (ans) {
      printf("YES\n");
    } else {
      printf("NO\n");
    }
  }
  return 0;
}
