You are given four positive integers n, m, a, b (1 ≤ b ≤ n ≤ 50; 1 ≤ a ≤ m ≤ 50). Find any such rectangular matrix of size n × m that satisfies all of the following conditions:

  * each row of the matrix contains exactly a ones; 
  * each column of the matrix contains exactly b ones; 
  * all other elements are zeros. 



If the desired matrix does not exist, indicate this.

For example, for n=3, m=6, a=2, b=1, there exists a matrix satisfying the conditions above:

$$$ \begin{vmatrix} 0 & 1 & 0 & 0 & 0 & 1 \\\ 1 & 0 & 0 & 1 & 0 & 0 \\\ 0 & 0 & 1 & 0 & 1 & 0 \end{vmatrix} $$$

Input

The first line contains an integer t (1 ≤ t ≤ 1000) — the number of test cases. Then t test cases follow.

Each test case is described by four positive integers n, m, a, b (1 ≤ b ≤ n ≤ 50; 1 ≤ a ≤ m ≤ 50), where n and m are the sizes of the matrix, and a and b are the number of ones for rows and columns, respectively.

Output

For each test case print:

  * "YES" (without quotes) and the required matrix (if there are several answers, print any) if it exists, or 
  * "NO" (without quotes) if it does not exist. 



To print the matrix n × m, print n rows, each of which consists of m numbers 0 or 1 describing a row of the matrix. Numbers must be printed without spaces.

Example

Input


5
3 6 2 1
2 2 2 1
2 2 2 2
4 4 2 2
2 1 1 2


Output


YES
010001
100100
001010
NO
YES
11
11
YES
1100
1100
0011
0011
YES
1
1
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.PriorityQueue;

public class SolutionG {
	class Node{
		Integer pos;
		Integer count;
		Integer round;
		Node(int pos, int count){
			this.pos = pos;
			this.count = count;
			this.round = 0;
		}
		
		Node(int pos, int count, int round){
			this.pos = pos;
			this.count = count;
			this.round = round;
		}
	}
	public void abMatrix(int n, int m, int a, int b){
		PriorityQueue<Node> q = new PriorityQueue<Node>(new Comparator<Node>(){

			@Override
			public int compare(Node arg0, Node arg1) {
				// TODO Auto-generated method stub
				return (31*(arg0.round - arg1.round) + arg0.count - arg1.count);
			}
			
		});
		/*q.add(new Node(2, 5,0));
		q.add(new Node(1, 5,1));
		q.add(new Node(2, 8,0));
		Node n1 = q.poll();
		System.out.println(n1.count+","+n1.pos);
		n1 = q.poll();
		System.out.println(n1.count+","+n1.pos);
		n1 = q.poll();
		System.out.println(n1.count+","+n1.pos);
		*/
		int total = n*m;
		int count11 = n *a;
		int count01 = total - (n*a);
		int count12 = m*b;
		int count02 = total - (m*b);
		int  maxcount1 = Math.max(count11, count12);
		int  maxcount0 = Math.max(count01, count02);
		
		if(total < (maxcount1+maxcount0)){
			System.out.println("NO");
			return;
		}
		else{
			System.out.println("YES");
		}
		long l = 0;
		char[] data = new char[m];
		for(int i = 0;i <m;i++){
			if(i < a){
				l |= 1L <<i;
				q.add(new Node(i, 1));
				data[i] = '1';
			}else{
				q.add(new Node(i, 0));
				data[i] = '0';
			}
		}
		System.out.println(String.valueOf(data));
		// String[] res = new String[n];
		for(int j = 1; j < n;j++){
			char[] data1 = new char[m];
			for(int i = 0;i <m;i++){
				Node t = q.poll();
				if(i <a){
				data1[t.pos] = '1';
				t.count++;
				}else{
					data1[t.pos] = '0';
				}
				t.round = j;
				q.add(t);
			}
			System.out.println(String.valueOf(data1));
		}
	}
	
	public static void main(String[] args)throws Exception{
		SolutionG g = new SolutionG();
		BufferedReader rd = new BufferedReader(new InputStreamReader(System.in));
		String lines =  rd.readLine();
		int totalLines = Integer.parseInt(lines);
		int tt = 1;
		while(totalLines-- > 0){
			String l =  rd.readLine();
			String[] ls = l.split(" ");
			int n = Integer.parseInt(ls[0]);
			int m = Integer.parseInt(ls[1]);
			int a = Integer.parseInt(ls[2]);
			int b = Integer.parseInt(ls[3]);
		    g.abMatrix(n, m, a, b);
		    }
	}

}
