A bitstring is a string consisting only of the characters 0 and 1. A bitstring is called k-balanced if every substring of size k of this bitstring has an equal amount of 0 and 1 characters (k/2 of each).

You are given an integer k and a string s which is composed only of characters 0, 1, and ?. You need to determine whether you can make a k-balanced bitstring by replacing every ? characters in s with either 0 or 1.

A string a is a substring of a string b if a can be obtained from b by deletion of several (possibly, zero or all) characters from the beginning and several (possibly, zero or all) characters from the end.

Input

Each test contains multiple test cases. The first line contains the number of test cases t (1 ≤ t ≤ 10^4). Description of the test cases follows.

The first line of each test case contains two integers n and k (2 ≤ k ≤ n ≤ 3 ⋅ 10^5, k is even) — the length of the string and the parameter for a balanced bitstring.

The next line contains the string s (|s| = n). It is given that s consists of only 0, 1, and ?.

It is guaranteed that the sum of n over all test cases does not exceed 3 ⋅ 10^5.

Output

For each test case, print YES if we can replace every ? in s with 0 or 1 such that the resulting bitstring is k-balanced, or NO if it is not possible.

Example

Input


9
6 4
100110
3 2
1?1
3 2
1?0
4 4
????
7 4
1?0??1?
10 10
11??11??11
4 2
1??1
4 4
?0?0
6 2
????00


Output


YES
YES
NO
YES
YES
NO
NO
YES
NO

Note

For the first test case, the string is already a 4-balanced bitstring.

For the second test case, the string can be transformed into 101.

For the fourth test case, the string can be transformed into 0110.

For the fifth test case, the string can be transformed into 1100110.
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000000 + 7;
const long long MOD1 = 998244353;
long long mod(long long x) { return (x % MOD + MOD) % MOD; }
long long mul(long long a, long long b) { return mod(mod(a) * mod(b)); }
string itos(long long s) {
  string str = to_string(s);
  return str;
}
long long stoi2(string s) {
  long long a = atoi(s.c_str());
  return a;
}
long long powerm(long long a, long long b, long long MOD) {
  a %= MOD;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}
long long power(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
bool isSubSequence(string str1, string str2, int m, int n) {
  if (m == 0) return true;
  if (n == 0) return false;
  if (str1[m - 1] == str2[n - 1])
    return isSubSequence(str1, str2, m - 1, n - 1);
  return isSubSequence(str1, str2, m, n - 1);
}
bool ispalindrome(long long len, string str) {
  for (int i = 0; i < len / 2; i++) {
    if (str[i] != str[len - 1 - i]) {
      return false;
    }
  }
  return true;
}
long long binarySearch(long long a[], long long low, long long high,
                       long long key) {
  while (low <= high) {
    long long mid = (low + high) / 2;
    if (a[mid] < key) {
      low = mid + 1;
    } else if (a[mid] > key) {
      high = mid - 1;
    } else {
      return mid;
    }
  }
  return -1;
}
inline bool isPowerOfTwo(long long x) {
  return ((1LL << (long long)log2(x)) == x);
}
long long isprime(long long N) {
  if (N < 2 || (!(N & 1) && N != 2)) return 0;
  for (long long i = 3; i * i <= N; i += 2) {
    if (!(N % i)) return 0;
  }
  return 1;
}
vector<long long> factor;
void factors(long long n) {
  for (long long i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (i == n / i)
        factor.push_back(i);
      else {
        factor.push_back(i);
        factor.push_back(n / i);
      }
    }
  }
  sort((factor).begin(), (factor).end());
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
bool isvalid(long long i, long long j, long long n) {
  if (i >= 0 && i < n && j >= 0 && j < n) return true;
  return false;
}
long long dx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
long long dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
long long binarytodecimal(string n) {
  string num = n;
  long long dec_value = 0;
  long long base = 1;
  long long len = num.length();
  for (int i = len - 1; i >= 0; i--) {
    if (num[i] == '1') dec_value += base;
    base = base * 2;
  }
  return dec_value;
}
string dtb(long long n) {
  string s = "";
  while (n > 0) {
    if (n % 2 == 0)
      s.push_back('0');
    else
      s.push_back('1');
    n /= 2;
  }
  reverse((s).begin(), (s).end());
  return s;
}
vector<long long> seive;
void Seive() {
  const long long maxn = 1e6 + 5;
  seive.resize(maxn);
  for (long long i = (long long)0; i < (long long)maxn; i++) seive[i] = i;
  for (long long i = 2; i <= maxn; i += 2) seive[i] = 2;
  seive[1] = -1;
  seive[0] = -1;
  for (long long i = 3; i <= maxn; i += 2)
    if (i == seive[i])
      for (long long j = i * i; j < maxn; j += i)
        if (seive[j] == j) seive[j] = i;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long T;
  cin >> T;
  while (T--) {
    long long n, k, f = 0;
    cin >> n >> k;
    string s;
    cin >> s;
    for (long long i = (long long)0; i < (long long)n; i++) {
      if (i + k < n) {
        if (s[i + k] == '0') {
          if (s[i] == '0')
            ;
          else if (s[i] == '1')
            f = 1;
          else
            s[i] = '0';
        } else if (s[i + k] == '1') {
          if (s[i] == '1')
            ;
          else if (s[i] == '0')
            f = 1;
          else
            s[i] = '1';
        } else {
          if (s[i] == '0')
            s[i + k] = '0';
          else if (s[i] == '1')
            s[i + k] = '1';
        }
      }
    }
    long long z = 0, o = 0, q = 0;
    for (long long i = (long long)n - 1; i >= (long long)n - k; i--) {
      if (s[i] == '0')
        z++;
      else if (s[i] == '1')
        o++;
      else
        q++;
    }
    for (long long i = (long long)n - 1; i >= (long long)n - k; i--) {
      if (s[i] == '?') {
        if (z < k / 2) {
          s[i] = '0';
          z++;
        } else {
          s[i] = '1';
          o++;
        }
      }
    }
    reverse((s).begin(), (s).end());
    for (long long i = (long long)0; i < (long long)n; i++) {
      if (i + k < n) {
        if (s[i + k] == '0') {
          if (s[i] == '0')
            ;
          else if (s[i] == '1')
            f = 1;
          else
            s[i] = '0';
        } else if (s[i + k] == '1') {
          if (s[i] == '1')
            ;
          else if (s[i] == '0')
            f = 1;
          else
            s[i] = '1';
        } else {
          if (s[i] == '0')
            s[i + k] = '0';
          else if (s[i] == '1')
            s[i + k] = '1';
        }
      }
    }
    reverse((s).begin(), (s).end());
    z = 0;
    o = 0;
    long long j = 0;
    for (long long i = (long long)0; i < (long long)k; i++) {
      if (s[i] == '0')
        z++;
      else
        o++;
    }
    if (z != o) f = 1;
    for (long long i = (long long)k; i < (long long)n; i++) {
      if (s[i] == '0')
        z++;
      else
        o++;
      if (s[j] == '0')
        z--;
      else
        o--;
      if (z != o) f = 1;
      j++;
    }
    if (f)
      cout << "NO\n";
    else
      cout << "YES\n";
  }
}
