#include <bits/stdc++.h>
using namespace std;
char aa[1000000 + 9];
string ss;
int main() {
  long long i, j, k, l, n, m = 0, tot, temp, curr, val, prev, a, b, c, t, ans,
                           main_flag, flag, x, y, siz, w, h, d, ii, jj, xx, yy,
                           ind, len, max_n, q, s, f, g;
  cin >> t;
  while (t--) {
    scanf("%lld%lld", &n, &m);
    scanf("%s", aa);
    ss = aa;
    len = ss.size();
    temp = 0;
    a = 0;
    b = 0;
    c = 0;
    d = 0;
    for (i = 0; i < len; i++) {
      if (aa[i] == 'X') {
        if (temp) {
          if (temp >= (2 * m)) {
            a++;
            val = temp;
          }
          if (temp >= m && temp < n) c++;
          if (temp >= n) b++;
          d++;
          tot = temp;
        }
        temp = 0;
      } else {
        temp++;
      }
    }
    if (temp) {
      if (temp >= (2 * m)) {
        a++;
        val = temp;
      }
      if (temp >= m && temp < n) c++;
      if (temp >= n) b++;
      d++;
      tot = temp;
    }
    if (m == 1) {
      if (d == 1 && tot == n)
        ans = 1;
      else
        ans = 0;
    } else {
      if (c)
        ans = 0;
      else {
        if (a > 1)
          ans = 0;
        else if (a == 1) {
          if (val < n)
            ans = 0;
          else if (val > (n + 4 * m - 2))
            ans = 0;
          else {
            if (val < n + m) {
              if (b % 2)
                ans = 1;
              else
                ans = 0;
            } else {
              if (val <= (n + 2 * m - 2)) {
                xx = val - n;
                if (xx >= n)
                  ans = 1;
                else {
                  if (b % 2)
                    ans = 1;
                  else
                    ans = 0;
                }
              } else if (n >= 2 * m)
                ans = 0;
              else if (val <= (n + 3 * m - 2)) {
                xx = val - n;
                if (xx >= n) {
                  if (xx >= n * 2)
                    ans = 1;
                  else {
                    if ((b + 1) % 2)
                      ans = 1;
                    else
                      ans = 0;
                  }
                } else {
                  ans = 0;
                }
              } else {
                xx = val - n;
                xx /= 2;
                yy = val - n - xx;
                if (xx >= n && yy >= n && xx <= 2 * m && yy <= 2 * m) {
                  if (b % 2)
                    ans = 1;
                  else
                    ans = 0;
                } else {
                  ans = 0;
                }
              }
            }
          }
        } else {
          if (b % 2)
            ans = 1;
          else
            ans = 0;
        }
      }
    }
    if (ans)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
