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.
//   package com.company;
  import javax.swing.*;
  import java.util.*;
  import java.io.*;
  import java.lang.*;
  /*
   ** @author jigar_nainuji
   */
  public class Main{

      public static void main(String args[]){
          PrintWriter out=new PrintWriter(System.out);
          InputReader in=new InputReader(System.in);
          TASK solver = new TASK();
          int t = in.nextInt();
//        int t=1;
          for(int i=0;i<t;i++)
          {
              solver.solve(in,out,i);
          }
          out.close();
      }
      static class TASK {
          static int mod = 1000000007;

          void solve(InputReader in, PrintWriter out, int testNumber) {
           int n = in.nextInt();
           int k = in.nextInt();
           char[] s = in.next().toCharArray();

           int o=0,z=0,q=0;
           for(int i=0;i<k;i++)
           {
//               System.out.println(2);
               if(s[i]=='1')
                   o++;
               else if(s[i]=='0')
                   z++;
               else
                   q++;
           }
           int min = Math.min(o,z);
           int max=Math.max(o,z);
           if(max-min>q)
           {
               System.out.println("NO");
               return;
           }
           else if(k==n && max-min<=q)
           {
               System.out.println("YES");
               return;
           }
           for(int i=0;i<n-k;i++)
           {
//               System.out.println(1);
//               System.out.println(i);
                if(s[i]!=s[i+k] &&(s[i]=='?' || s[i+k]=='?'))
                {
                    if(s[i]=='?')
                        s[i]=s[i+k];
                    else if(s[i+k]=='?')
                        s[i+k]=s[i];
                }
                else if(s[i]!=s[i+k] && s[i]!='?' && s[i+k]!='?')
                {
                    System.out.println("NO");
                    return;
                }
           }
              for(int i=n-1;i>=k;i--)
              {
//                  System.out.println(3);
//               System.out.println(i);
                  if(s[i]!=s[i-k] &&(s[i]=='?' || s[i-k]=='?'))
                  {
                      if(s[i]=='?')
                          s[i]=s[i-k];
                      else if(s[i-k]=='?')
                          s[i-k]=s[i];
                  }
                  else if(s[i]!=s[i-k] && s[i]!='?' && s[i-k]!='?')
                  {
                      System.out.println("NO");
                      return;
                  }
              }
              o=0;z=0;q=0;
              for(int i=0;i<k;i++)
              {
//                  System.out.println(3);
                  if(s[i]=='1')
                      o++;
                  else if(s[i]=='0')
                      z++;
                  else
                      q++;
              }
//              System.out.println(String.valueOf(s));

              min = Math.min(o,z);
              max = Math.max(o,z);
              if(max-min>q)
                  System.out.println("NO");
              else
                  System.out.println("YES");







          }
      }

      static class pair{
          int x;
          int y;
          pair(int x,int y)
          {
              this.x=x;
              this.y=y;
          }

      }


      static class InputReader {
          private InputStream stream;
          private byte[] buf = new byte[1024];
          private int curChar;
          private int numChars;
          private SpaceCharFilter filter;

          public InputReader(InputStream stream) {
              this.stream = stream;
          }

          public int read() {
              if (numChars == -1)
                  throw new InputMismatchException();

              if (curChar >= numChars) {
                  curChar = 0;
                  try {
                      numChars = stream.read(buf);
                  } catch (IOException e) {
                      throw new InputMismatchException();
                  }

                  if (numChars <= 0)
                      return -1;
              }
              return buf[curChar++];
          }

          public String nextLine() {
              BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
              String str = "";
              try {
                  str = br.readLine();
              } catch (IOException e) {
                  e.printStackTrace();
              }
              return str;
          }

          public int nextInt() {
              int c = read();

              while (isSpaceChar(c))
                  c = read();

              int sgn = 1;

              if (c == '-') {
                  sgn = -1;
                  c = read();
              }

              int res = 0;
              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              while (!isSpaceChar(c));

              return res * sgn;
          }

          public long nextLong() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              long res = 0;

              do {
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              while (!isSpaceChar(c));
              return res * sgn;
          }

          public double nextDouble() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              int sgn = 1;
              if (c == '-') {
                  sgn = -1;
                  c = read();
              }
              double res = 0;
              while (!isSpaceChar(c) && c != '.') {
                  if (c == 'e' || c == 'E')
                      return res * Math.pow(10, nextInt());
                  if (c < '0' || c > '9')
                      throw new InputMismatchException();
                  res *= 10;
                  res += c - '0';
                  c = read();
              }
              if (c == '.') {
                  c = read();
                  double m = 1;
                  while (!isSpaceChar(c)) {
                      if (c == 'e' || c == 'E')
                          return res * Math.pow(10, nextInt());
                      if (c < '0' || c > '9')
                          throw new InputMismatchException();
                      m /= 10;
                      res += (c - '0') * m;
                      c = read();
                  }
              }
              return res * sgn;
          }

          public String readString() {
              int c = read();
              while (isSpaceChar(c))
                  c = read();
              StringBuilder res = new StringBuilder();
              do {
                  res.appendCodePoint(c);
                  c = read();
              }
              while (!isSpaceChar(c));

              return res.toString();
          }

          public boolean isSpaceChar(int c) {
              if (filter != null)
                  return filter.isSpaceChar(c);
              return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
          }

          public String next() {
              return readString();
          }

          public interface SpaceCharFilter {
              public boolean isSpaceChar(int ch);
          }
      }
  }
