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.
import java.util.*;
import java.io.*;

public class A668 {
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt(); int k = sc.nextInt();
            String s = sc.next();
            int [] a = new int[n];
            for (int i = 0; i < n; i++) {
                if (s.charAt(i) == '0') a[i] = 0;
                else if (s.charAt(i) == '1') a[i] = 1;
                else a[i] = -1;
            }
            int cur = 0; int left = 0; int [] mod = new int[k];
            for (int i = 0; i < k; i++) {
                if (a[i] == 1) cur += a[i];
                if (a[i] == -1) left++;
                mod[i] = a[i];
            }
            boolean ok = true; int start = 0;
            if (cur > k / 2 || cur + left < k / 2) {
                ok = false;
            }
            for (int i = k; i < n; i++) {
                if (mod[i % k] == -1) {
                    if (a[i] != -1) mod[i % k] = a[i];
                } else {
                    if (a[i] != mod[i % k] && a[i] != -1) ok = false;
                    else {
                        a[i] = mod[i % k];
                    }
                }
            }
            cur = 0; left = 0;
            for (int i = 0; i < k; i++) {
                if (mod[i] == 1) cur++;
                if (mod[i] == -1) left++;
            }
            if (cur > k / 2 || cur + left < k / 2) {
                ok = false;
            }
            out.println(ok ? "YES" : "NO");
        }
        out.close();
    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }

}