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

public class Q1 {
	private void solve(Scan scan, Print print) throws Exception {
		int T = scan.nextInt();
		loop:
		while (T-- > 0) 
		{
			int N=scan.nextInt();
			int K=scan.nextInt();
			char arr[]=scan.next('a');
			int j=K;
			for(int i=0;i+K<N;i++,j++)
			{
				if(arr[i]==arr[j])
				{
					continue;
				}
				else if(arr[i]!='?' && arr[j]!='?')
				{
					print.println("NO");
					continue loop;
				}
				else if(arr[i]=='?')
				{
					arr[i]=arr[j];
				}
				else
				{
					arr[j]=arr[i];
				}
			}
			int c1=0,c0=0,c=0;
			for(int i=0;i<K;i++)
			{
				if(arr[i]=='1')
				{
					c1++;
				}
				else if(arr[i]=='0')
				{
					c0++;
				}
				else
				{
					c++;
				}
			}
			if(Math.min(c1, c0)+c<Math.max(c1, c0))
			{
				print.println("NO");
				continue loop;
			}
			for(int i=K;i<N;i++)
			{
				if(arr[i]=='1')
				{
					c1++;
				}
				else if(arr[i]=='0')
				{
					c0++;
				}
				else
				{
					c++;
				}
				if(arr[i-K]=='1')
				{
					c1--;
				}
				else if(arr[i-K]=='0')
				{
					c0--;
				}
				else
				{
					c--;
				}
				if(Math.min(c1, c0)+c<Math.max(c1, c0))
				{
					print.println("NO");
					continue loop;
				}
			}
			print.println("YES");
		}
	}

	public static void main(String args[]) throws Exception {
		Scan scan = new Scan();
		Print print = new Print();
		Q1 o = new Q1();
		o.solve(scan, print);
		print.close();
	}

	public static class Print {
		private final BufferedWriter bw;

		public Print() {
			this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
		}

		public void print(Object object) throws IOException {
			bw.append("" + object);
		}

		public void println(Object object) throws IOException {
			print(object);
			bw.append("\n");
		}

		public void println(int object[]) throws IOException {
			print(Arrays.toString(object));
			bw.append("\n");
		}

		public void print(int object[]) throws IOException {
			print(Arrays.toString(object));
		}

		public void println(long object[]) throws IOException {
			print(Arrays.toString(object));
			bw.append("\n");
		}

		public void print(long object[]) throws IOException {
			print(Arrays.toString(object));
		}

		public void println(boolean object[]) throws IOException {
			print(Arrays.toString(object));
			bw.append("\n");
		}

		public void print(boolean object[]) throws IOException {
			print(Arrays.toString(object));
		}

		public void println(Object object[]) throws IOException {
			print(Arrays.deepToString(object));
			bw.append("\n");
		}

		public void print(Object object[]) throws IOException {
			print(Arrays.deepToString(object));
		}

		public void close() throws IOException {
			bw.close();
		}
	}

	static class Scan {
		private byte[] buf = new byte[1024 * 1024 * 4];
		private int index;
		private InputStream in;
		private int total;

		public Scan() {
			in = System.in;
		}

		public int scan() throws IOException {
			if (total < 0)
				throw new InputMismatchException();
			if (index >= total) {
				index = 0;
				total = in.read(buf);
				if (total <= 0)
					return -1;
			}
			return buf[index++];
		}

		public int nextInt() throws IOException {
			int integer = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n)) {
				if (n >= '0' && n <= '9') {
					integer *= 10;
					integer += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			return neg * integer;
		}

		public double nextDouble() throws IOException {
			double doub = 0;
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			int neg = 1;
			if (n == '-') {
				neg = -1;
				n = scan();
			}
			while (!isWhiteSpace(n) && n != '.') {
				if (n >= '0' && n <= '9') {
					doub *= 10;
					doub += n - '0';
					n = scan();
				} else
					throw new InputMismatchException();
			}
			if (n == '.') {
				n = scan();
				double temp = 1;
				while (!isWhiteSpace(n)) {
					if (n >= '0' && n <= '9') {
						temp /= 10;
						doub += (n - '0') * temp;
						n = scan();
					} else
						throw new InputMismatchException();
				}
			}
			return doub * neg;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			long c = scan();
			while (c <= ' ') {
				c = scan();
			}

			boolean neg = (c == '-');
			if (neg) {
				c = scan();
			}

			do {
				ret = ret * 10 + c - '0';
			} while ((c = scan()) >= '0' && c <= '9');

			if (neg) {
				return -ret;
			}
			return ret;
		}

		public String next() throws IOException {
			StringBuilder sb = new StringBuilder();
			int n = scan();
			while (isWhiteSpace(n))
				n = scan();
			while (!isWhiteSpace(n) || n == ' ') {
				sb.append((char) n);
				n = scan();
			}
			return sb.toString();
		}

		public void next(int arr[]) throws IOException {
			for (int i = 0; i < arr.length; i++) {
				arr[i] = nextInt();
			}
		}

		public void next(long arr[]) throws IOException {
			for (int i = 0; i < arr.length; i++) {
				arr[i] = nextLong();
			}
		}

		public char[] next(char c) throws IOException {
			char arr[] = next().toCharArray();
			return arr;
		}

		private boolean isWhiteSpace(int n) {
			if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
				return true;
			return false;
		}
	}
}