#include <bits/stdc++.h>
const int maxn = 0x3f3f3f3f;
const double EI =
    2.71828182845904523536028747135266249775724709369995957496696762772407663035354594571382178525166427;
const double PI = 3.141592653589793238462643383279;
using namespace std;
char c[300010];
int cc[10];
int main(void) {
  int q, a, b, i, j, pos;
  scanf("%d", &q);
  while (q--) {
    scanf("%d %d", &a, &b);
    scanf("%s", c);
    int len = strlen(c);
    memset(cc, 0, sizeof(cc));
    for (i = 0; i < len; i++) {
      if (c[i] == 'X') {
        continue;
      }
      int sum = 0;
      for (j = i; j < len; j++) {
        if (c[j] != c[i]) {
          break;
        }
        sum++;
      }
      if (sum >= b && sum < a) {
        cc[1]++;
      } else if (sum >= a && sum < 2 * b) {
        cc[2]++;
      } else if (sum >= 2 * b && sum >= a) {
        cc[3]++;
        pos = sum;
      }
      i = j;
    }
    if (cc[1] || cc[3] > 1) {
      printf("NO\n");
    } else if (cc[3] == 0) {
      if (cc[2] % 2 == 1) {
        printf("YES\n");
      } else {
        printf("NO\n");
      }
    } else {
      if (cc[2] % 2 == 0 &&
              (pos <= a + 2 * b - 2 || pos <= a + 4 * b - 2 && pos >= 3 * a) ||
          cc[2] % 2 && (pos <= a + 3 * b - 2 && pos >= 2 * a)) {
        printf("YES\n");
      } else {
        printf("NO\n");
      }
    }
  }
  return 0;
}
