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 LeetCode;

import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class Main {

	static class Reader {
		BufferedReader br;
		StringTokenizer st;

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

		public int nextInt() throws IOException {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return Integer.parseInt(st.nextToken());
		}

		public float nextFloat() throws IOException {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return Float.parseFloat(st.nextToken());
		}

		public long nextLong() throws IOException {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return Long.parseLong(st.nextToken());
		}

		public double nextDouble() throws IOException {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return Double.parseDouble(st.nextToken());
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public String next() throws IOException {
			if (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}
	}

	static class Pair<T1 extends Comparable<T1>, T2 extends Comparable<T2>> implements Comparable<Pair<T1, T2>> {
		T1 first;
		T2 second;

		public Pair(T1 first, T2 second) {
			this.first = first;
			this.second = second;
		}

		@Override
		public int compareTo(Pair<T1, T2> o) {
			return this.first.compareTo(o.first);
		}
	}

	public static long[] initArray(int n) throws IOException {
		long arr[] = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
		}
		return arr;
	}

	public static long mul(long a, long b) {
		return (a * b) % mod;
	}

	public static long add(long a, long b) {
		return (a + b) % mod;
	}

	public static long max(long arr[]) throws IOException {
		long max = Long.MIN_VALUE;
		for (long a : arr) {
			max = Math.max(max, a);
		}
		return max;
	}

	public static long min(long arr[]) throws IOException {
		long min = Long.MAX_VALUE;
		for (long a : arr) {
			min = Math.min(min, a);
		}
		return min;
	}

	public static long sum(long arr[]) throws IOException {
		long sum = 0;
		for (long a : arr) {
			sum += a;
		}
		return sum;
	}

	public static ArrayList<Integer>[] initAdjacency(int n, int e, boolean undirected) throws IOException {
		ArrayList<Integer>[] list = new ArrayList[n + 1];
		for (int i = 0; i <= n; i++) {
			list[i] = new ArrayList<>();
		}
		for (int i = 0; i < e; i++) {
			int u = sc.nextInt();
			int v = sc.nextInt();
			list[u].add(v);
			if (undirected)
				list[v].add(u);
		}
		return list;
	}

	private static void solve() throws IOException {
		int n = sc.nextInt();
		int k = sc.nextInt();
		String str = sc.next();
		char[] arr = str.toCharArray();
		int ones = 0, zeros = 0, unknown = 0;
		boolean flag = true;
		for (int e = k; e < n && flag; e++) {
			int s = e - k;
			if (arr[s] == '1') {
				if (arr[e] == '0') {
					flag = false;
					break;
				} else if (arr[e] == '?') {
					arr[e] = '1';
				}
			} else if (arr[s] == '0') {
				if (arr[e] == '1') {
					flag = false;
					break;
				} else if (arr[e] == '?') {
					arr[e] = '0';
				}
			} else {
				arr[s] = arr[e];
			}
		}
		if(flag) {
			for (int i = 0; i < k-1; i++) {
				if (arr[i] == '1')
					ones++;
				else if (arr[i] == '0')
					zeros++;
				else {
					unknown++;
				}
			}
			for(int e=k-1;e<n;e++) {
				int s = e-k;
				if(s>=0) {
					if(arr[s]=='1')
						ones--;
					else if(arr[s]=='0')
						zeros--;
					else
						unknown--;
				}
				if(arr[e]=='1')
					ones++;
				else if(arr[e]=='0')
					zeros++;
				else {
					unknown++;
				}
				
				int diff = Math.abs(zeros-ones);
				if(unknown<diff) {
					flag = false;
					break;
				}
			}
		}
//		System.out.println(Arrays.toString(arr));
		out.println(flag ? "YES" : "NO");
	}

	private static void readt() throws IOException {
		T = sc.nextInt();
	}

	static int mod = (int) (1e9 + 7);
	static int T;
	static Reader sc;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		sc = new Reader();
		out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		try {
			T = 1;
			readt();
			while (T-- > 0) {
				solve();
			}
			out.flush();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}