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 R668C {
	public static void main(String[] args) {
		JS scan = new JS();
		int t = scan.nextInt();
		outer:while(t-->0) {
			int n = scan.nextInt();
			int k = scan.nextInt();
			String s= scan.next();
			char[] arr = s.toCharArray();
			for(int i = 0;i<k;i++) {
				int val = -1;
				for(int j = i;j<n;j+=k) {
					if(arr[j]=='1') {
						if(val==0) {
							System.out.println("NO");
							continue outer;
						}
						val = 1;
					}else if(arr[j]=='0') {
						if(val==1) {
							System.out.println("NO");
							continue outer;
						}
						val = 0;
					}
				}
				if(val==-1)continue;
				for(int j = i;j<n;j+=k) {
					arr[j] = (char)(val+'0');
				}
			}
			s = "";
			StringBuilder sb = new StringBuilder();
			for(int i = 0;i<n;i++) {
				sb = sb.append(arr[i]);
			}
			s = sb.toString();
			//System.out.println(s);
			int[] start =new int[n];
			int ones = 0;
			for(int i = n-1;i>=0;i--) {
				if(s.charAt(i)=='1') {
					ones++;
				}
				if(i+k<n) {
					if(s.charAt(i+k)=='1')ones--;
				}
				start[i] = ones;
			}
			node seg = new node(1, n);
			for(int i =0 ;i<n;i++) {
				seg.add(i+1, i+1, start[i]);
			}
//			for(int j = 1;j<=n;j++) {
//				System.out.print(seg.getSum(j, j)+" ");
//			}
//			System.out.println();
			int fix = 1;
			int done = Integer.MIN_VALUE;
			for(int i = 1;i<=n;i++) {
				while(fix<=n && seg.getSum(fix, fix)==k/2) {
					fix++;
					done = fix-1;
				}
				if(done>i-k)continue;
				if(s.charAt(i-1)=='?') {
					seg.add(Math.max(1, i-k+1), i, 1);
				}
//				System.out.println(i+" "+done);
//				for(int j = 1;j<=n;j++) {
//					System.out.print(seg.getSum(j, j)+" ");
//				}
//				System.out.println();
			}
			for(int i = 1;i<=n-k+1;i++) {
				if(seg.getSum(i, i)!=k/2) {
					System.out.println("NO");
					continue outer;
				}
			}
			System.out.println("YES");
			
		}
	}
/*
1
10 8
1????????1

1
12 4
0?10?11?????
 */
	static class node{
	    long li, ri, m;
	    long sum, min, lazy = 0;
	    node l = null, r = null;
	    node(long liIn, long riIn){
	        li = liIn;
	        ri = riIn;
	        m = (li + ri) / 2;
	        if(li != ri){
	            l = new node(li, m);
	            r = new node(m + 1, ri);
	        }
	    }
	    void add(int s, int e, int v){
	        if(s <= li && ri <= e){
	            sum += (ri - li + 1) * v;
	            min += v;
	            lazy += v;
	            return;
	        }
	        
	        push();
	        if(s <= m) l.add(s, e, v);
	        if(e > m) r.add(s, e, v);
	        sum = l.sum + r.sum;
	        min = Math.min(l.min, r.min);
	    }
	    long getSum(int s, int e){
	        if(s <= li && ri <= e) return sum;
	        
	        push();
	        long out = 0;
	        if(s <= m) out += l.getSum(s, e);
	        if(e > m) out += r.getSum(s, e);
	        return out;
	    }
	    long getMin(int s, int e){
	        if(s <= li && ri <= e) return min;
	        
	        push();
	        long out = Long.MAX_VALUE;
	        if(s <= m) out = Math.min(out, l.getMin(s, e));
	        if(e > m) out = Math.min(out, r.getMin(s, e));
	        return out;
	    }
	    void push(){
	        l.lazy += lazy;
	        l.sum += (l.ri - l.li + 1) * lazy;
	        l.min += lazy;
	            
	        r.lazy += lazy;
	        r.sum += (r.ri - r.li + 1) * lazy;
	        r.min += lazy;
	        
	        lazy = 0;
	    }
	}
	static class JS{
		public int BS = 1<<16;
		public char NC = (char)0;
		byte[] buf = new byte[BS];
		int bId = 0, size = 0;
		char c = NC;
		double num = 1;
		BufferedInputStream in;

		public JS() {
			in = new BufferedInputStream(System.in, BS);
		}

		public JS(String s) throws FileNotFoundException {
			in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
		}

		public char nextChar(){
			while(bId==size) {
				try {
					size = in.read(buf);
				}catch(Exception e) {
					return NC;
				}				
				if(size==-1)return NC;
				bId=0;
			}
			return (char)buf[bId++];
		}

		public int nextInt() {
			return (int)nextLong();
		}

		public long nextLong() {
			num=1;
			boolean neg = false;
			if(c==NC)c=nextChar();
			for(;(c<'0' || c>'9'); c = nextChar()) {
				if(c=='-')neg=true;
			}
			long res = 0;
			for(; c>='0' && c <='9'; c=nextChar()) {
				res = (res<<3)+(res<<1)+c-'0';
				num*=10;
			}
			return neg?-res:res;
		}

		public double nextDouble() {
			double cur = nextLong();
			return c!='.' ? cur:cur+nextLong()/num;
		}

		public String next() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c>32) {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public String nextLine() {
			StringBuilder res = new StringBuilder();
			while(c<=32)c=nextChar();
			while(c!='\n') {
				res.append(c);
				c=nextChar();
			}
			return res.toString();
		}

		public boolean hasNext() {
			if(c>32)return true;
			while(true) {
				c=nextChar();
				if(c==NC)return false;
				else if(c>32)return true;
			}
		}
	}

}