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
//package learning;
import java.util.*;
import java.io.*;
import java.lang.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class NitsLocal {
    static ArrayList<String> s1;
    static boolean[] prime;
    static int n = 200001;
    
     static void sieve() {
Arrays.fill(prime	, true);
prime[0] = prime[1] = false;
for(int i = 2 ; i * i <= n ; ++i) {
if(prime[i]) {
for(int k = i * i; k<= n ; k+=i) {
prime[k] = false;
}
}
}
 
}
    public static void main(String[] args) {
        InputReader sc = new InputReader(System.in);
        
           //prime  = new boolean[n + 1];
          // sieve();
                //prime[1] = false;
              
                  
             /*    
        int n = sc.ni();
        int k = sc.ni();
        int []vis = new int[n+1];
        int []a = new int[k];
        for(int i=0;i<k;i++)
        {
            a[i] = i+1;
        }
        int j = k+1;
        int []b = new int[n+1];
        for(int i=1;i<=n;i++)
        {
            b[i] = -1;
        }
        int y = n - k +1;
        int tr = 0;
        int y1 = k+1;
        while(y-- > 0)
        {
        System.out.print("? ");
        for(int i=0;i<k;i++)
        {
            System.out.print(a[i] + " ");
        }
        
        System.out.flush();
        int pos = sc.ni();
        int a1 = sc.ni();
        b[pos] = a1;
        
        
        for(int i=0;i<k;i++)
        {
            if(a[i] == pos)
            {
                a[i] = y1;
                y1++;
            }
        }
        }
        ArrayList<Integer> a2 = new ArrayList<>();
        if(y >= k)
        {
            
        int c = 0;
        int k1 = 0;
            for(int i=1;i<=n;i++)
            {
                if(b[i] != -1)
                {
                    c++;
                    a[k1] = i;
                    a2.add(b[i]);
                    k1++;
                }
                if(c==k)
                    break;
            }
            
            Collections.sort(a2);
            System.out.print("? ");
        for(int i=0;i<k;i++)
        {
            System.out.print(a[i] + " ");
        }
        System.out.println();
        System.out.flush();
        int pos = sc.ni();
        int a1 = sc.ni();
        int ans = -1;
        for(int i=0;i<a2.size();i++)
        {
            if(a2.get(i) == a1)
            {
                ans = i+1;
                break;
            }
        }
        System.out.println("!" + " " + ans);
           System.out.flush();  
        }
        else
        {
            int k1 = 0;
            a = new int[k];
             for(int i=1;i<=n;i++)
            {
                if(b[i] != -1)
                {
                    
                    a[k1] = i;
                    a2.add(b[i]);
                    k1++;
                }
             
            }
              for(int i=1;i<=n;i++)
            {
                if(b[i] == -1)
                {
                    
                    a[k1] = i;
                    
                    k1++;
                    if(k1==k)
                        break;
                }
             
            }
              int ans = -1;
              while(true)
              {
                   System.out.print("? ");
                     for(int i=0;i<k;i++)
                   {
                         System.out.print(a[i] + " ");
                  }
                   System.out.println();
                   System.out.flush();
                   int pos = sc.ni();
                   int a1 = sc.ni();
                   int f = 0;
                   
                   if(b[pos] != -1)
                   {
                       Collections.sort(a2);
                       for(int i=0;i<a2.size();i++)
                       {
                           if(a2.get(i) == a1)
                           {
                               ans = i+1;
                               f = 1;
                               System.out.println("!" + " " + ans);
                               System.out.flush();
                               break;
                           }
                       }
                       if(f==1)
                           break;
                   }
                   else
                   {
                       b[pos] = a1;
                        a = new int[k];
                        a2.add(a1);
             for(int i=1;i<=n;i++)
            {
                if(b[i] != -1)
                {
                    
                    a[k1] = i;
                    a2.add(b[i]);
                    k1++;
                }
             
            }
              for(int i=1;i<=n;i++)
            {
                if(b[i] == -1)
                {
                    
                    a[k1] = i;
                    
                    k1++;
                    if(k1==k)
                        break;
                }
             
                       
                   }
              }
        }  
          */
             
 
    /*
          int n = sc.ni();
          int []a = sc.nia(n);
          int []b = sc.nia(n);
          Integer []d = new Integer[n];
          int []d1 = new int[n];
          for(int i=0;i<n;i++)
          {
              d[i] = (a[i] - b[i]);
             
          }
          int l = 0;
          int r = n-1;
          Arrays.sort(d);
          long res = 0;
          while(l < r)
          {
              if(d[l] + d[r] > 0)
              {
                  res += (long) (r-l);
                  r--;
              }
              else 
                  l++;
          }
          
          w.println(res);
*/
      /*
      int n = sc.ni();
     
      ArrayList<Integer> t1 = new ArrayList<>();
      int []p1 = new int[n+1];
      int []q1 = new int[n-1];
      int []q2 = new int[n-1];
      for(int i=0;i<n-1;i++)
      {
          int p = sc.ni();
          int q = sc.ni();
          t1.add(q);
          p1[p]++;
          q1[i] = p;
          q2[i] = q;
          
      }
      int res = 0;
      for(int i=0;i<t1.size();i++)
      {
          if(p1[t1.get(i)] == 0)
          {
              res = t1.get(i);
              //break;
          }
      }
      
    int y = 1;
    for(int i=0;i<n-1;i++)
    {
        if(q2[i] == res)
        {
            w.println("0");
        }
        else
        {
            w.println(y + " ");
            y++;
        }
    }
      */
 /*
   int n = sc.ni();
   int k = sc.ni();
   Integer []a = new Integer[n];
   for(int i=0;i<n;i++)
   {
       a[i] = sc.ni();
       a[i] = a[i]%k;
   }
   HashMap<Integer,Integer> hm = new HashMap<>();
   for(int i=0;i<n;i++)
   {
       if(!hm.containsKey(a[i]))
           hm.put(a[i], 1);
       else
           hm.put(a[i], hm.get(a[i]) + 1);
   }
  Arrays.sort(a);
  int z = 0;
  long res = 0;
  HashMap<Integer,Integer> v = new HashMap<>();
  for(int i=0;i<n;i++)
  {
      if(a[i] == 0)
          res++;
      else
      {
          if(a[i] == k-a[i] && !v.containsKey(a[i]))
          {
              res += (long) hm.get(a[i]) / 2;
              v.put(a[i],1);
          }
          else
          {
          if(hm.containsKey(a[i]) && hm.containsKey(k-a[i]))
          {
          int temp = a[i];
          
          if(!v.containsKey(a[i]) && !v.containsKey(k-a[i]))
          {
             res += (long) Math.min(hm.get(temp), hm.get(k-temp));
             v.put(temp,1);
             v.put(k-temp,1);
          }
          }
          }
      }
  }
  w.println(res);
*/
 /*
int []a = new int[4];
//G0
a[0] = 0;
a[1] = 1;
a[2] = 0;
a[3] = 1;
int []b = new int[4];
//g1
b[0] = 0;
b[1] = 1;
b[2] = 1;
b[3] = 0;
int [][]dp1 = new int[4][4];
int [][]dp2 = new int[4][4];
for(int i=0;i<4;i++)
{
    for(int j=0;j<4;j++)
    {
        dp1[i][j] = (a[i] | a[j]);
    }
   // w.println();
}
w.println();
for(int i=0;i<4;i++)
{
    for(int j=0;j<4;j++)
    {
        dp2[i][j] = (b[i] | b[j]);
    }
    //w.println();
}
int a1 = 0;
int b1 = 0;
int c1 = 0;
int d1 = 0;
for(int i=0;i<4;i++)
{
    for(int j=0;j<4;j++)
    {
        if(dp1[i][j] == 0 && dp2[i][j] == 0)
            a1++;
        else  if(dp1[i][j] == 1 && dp2[i][j] == 1)
            b1++;
        else  if(dp1[i][j] == 0 && dp2[i][j] == 1)
            c1++;
        else
            d1++;
       
    }
}
w.println(a1+ " " + b1 + " " + c1 +" "+ d1);

Scanner sc = new Scanner(System.in);
    int q = sc.nextInt();
    while(q-- > 0)
    {
        long x = sc.nextLong();
        long y = sc.nextLong();
        long a = (x - y)/2;  
        long a1 = 0, b1 = 0; 
        
        
        int lim     = 8; 
  
   
    int f = 0;
    
    for (int i=0; i<8*lim; i++)  
    {  
        long pi = (y & (1 << i));  
        long qi = (a & (1 << i));  
        if (pi == 0 && qi == 0)  
        {  
             
        }  
        else if (pi == 0 && qi > 0)  
        {  
            a1 = ((1 << i) | a1);  
            b1 = ((1 << i) | b1);  
        }  
        else if (pi > 0 && qi == 0)  
        {  
            a1 = ((1 << i) | a1);  
  
           
        }  
        else
        {  
            f = 1;  
            
        }  
    }  
    if(a1+b1 != x)
        f  =1;
  if(f==1)
            System.out.println("-1");
  else
  {
       if(a1 > b1)
       {
           long temp = a1;
           a1 = b1;
           b1 = temp;
       }
    System.out.println(a1 + " " + b1);
   
  }
  
  
    }
     
     */

     /*
    int n = sc.ni();
    int k = sc.ni();
    int []a = sc.nia(n);
    int []c = new int[n+1];
    int m = n;
    int f = 0;
    
        for(int i=0;i<k;i++)
        {
            c[a[i]]++;
        }
        HashSet<Integer> temp = new HashSet<>();
        for(int i=k;i<n;i++)
        {
            if(c[a[i]] == 0)
            {
                temp.add(a[i]);
            }
        }
        int re =  temp.size();
        int st = 0;
        if(re > 0)
        {
        for(int i=k-1;i>=0;i--)
        {
            
            c[a[i]]--;
            if(c[a[i]] == 0)
            {
                f = 1;
                break;
            }
            else
            {
                re--;
                if(re == 0)
                    break;
            }
        }
         st = k-temp.size();    
        }
    
    if(f==1 || st <0)
        w.println("-1");
    else
    {
           
        int div = 10000/k;
        int mod = 10000%k;
        Iterator itr = temp.iterator();
        while(itr.hasNext())
        {
            Integer e = (Integer) itr.next();
            a[st] = e;
            st++;
        }
        w.println("10000");
        for(int i=0;i<div;i++)
        {
            for(int j=0;j<k;j++)
            {
                w.print(a[j] + " ");
            }
        }
        for(int i=0;i<mod;i++)
        {
            w.print(a[i] + " ");
        }
        w.println();
    }
*/
     int t = sc.ni();
     while(t-- > 0)
     {
         int n = sc.ni();
         int m = sc.ni();
         int a = sc.ni();
         int b = sc.ni();
         ArrayList<String> temp = new ArrayList<>();
        
             if(n*a == m * b)
             {
                 w.println("YES");
                 print(n,m,a,b);
             }
             else
             {
                 w.println("NO");
             }
         
     }
             
 
       w.close();
       
        
    
    
} 
   static void print(int n,int m,int a,int b)
   {
       int []c = new int[m];
       int row = 0;
       char [][]ans = new char[n][m];
       for(int i=0;i<n;i++)
       {
           for(int j=0;j<m;j++)
           {
               ans[i][j] = '0';
           }
       }
       int ptr = 0;
       for(int i=0;i<n;i++)
       {
           for(int j=0;j<a;j++)
           {
               ans[i][ptr] = '1';
               ptr++;
               ptr%=m;
           }
       }
       for(int i=0;i<n;i++)
       {
           for(int j=0;j<m;j++)
           {
               w.print(ans[i][j]);
           }
           w.println();
       }
       
   }
    static int []res;
    static int c = 0;
    static class Pair{
        int fir;
        int last;
        Pair(int fir,int last)
        {
            this.fir = fir;
            this.last = last;
        }
    }
    static class m1 implements Comparator<Pair>{
        public int compare(Pair a, Pair b)
        {
            int t1 = a.last - a.fir;
            int t2 = b.last - b.fir;
            if(t1 < t2)
                return 1;
            else if(t1 > t2)
                return -1;
            else
            {
                if(a.fir < b.fir)
                    return -1;
                else
                    return 1;
            }
        }
    }
   
    static long calc(long x)
    {
        double res = Math.sqrt(1 + 24*(double)x);
        res -= 1.0;
        res = res / (double) 6;
        return (long) res;
    }
   
 public static final BigInteger MOD = BigInteger.valueOf(998244353L);
    
    static BigInteger fact(int x)
    {
        BigInteger res = BigInteger.ONE;
        for(int i=2;i<=x;i++)
        {
            res = res.multiply(BigInteger.valueOf(i)).mod(MOD);
        }
        return res;
    }
   
    public static long calc(int x,int y,int z)
    {
        long res = ((long) (x-y) * (long) (x-y)) + ((long) (z-y) * (long) (z-y)) + ((long) (x-z) * (long) (x-z));
        return res;
    }
    
    public static int upperBound(ArrayList<Integer>arr, int length, int value) {
        int low = 0;
        int high = length;
        while (low < high) {
            final int mid = (low + high) / 2;
            if (value >= arr.get(mid)) {
                low = mid + 1;
            } else {
                high = mid;
            }
        }
        return low;
    }
    
     public static int lowerBound(ArrayList<Integer> arr, int length, int value) {
        int low = 0;
        int high = length;
        while (low < high) {
            final int mid = (low + high) / 2;
            //checks if the value is less than middle element of the array
            if (value <= arr.get(mid)) {
                high = mid;
            } else {
                low = mid + 1;
            }
        }
        return low;
    }
    static HashMap<Long,Integer> map;
  
          
    static class Coin{
        long a;
        long b;
        
        Coin(long a, long b)
        {
            this.a = a;
            this.b = b;
           
        }
    }
    static ArrayList<Long> fac;
    static HashSet<Long> hs;
    public static void primeFactors(long n) 
    { 
        // Print the number of 2s that divide n 
        while (n % 2 == 0) { 
            fac.add(2l);
            hs.add(2l);
            n /= 2; 
        } 
  
        // n must be odd at this point.  So we can 
        // skip one element (Note i = i +2) 
        for (long i = 3; i*i <= n; i += 2) { 
            // While i divides n, print i and divide n 
            while (n % i == 0) { 
                fac.add(i);
                hs.add(i);
                n /= i; 
            } 
        } 
  
        // This condition is to handle the case whien 
        // n is a prime number greater than 2 
        if (n > 2) 
            fac.add(n);
    } 
   static int smallestDivisor(int n)  
{  
    // if divisible by 2  
    if (n % 2 == 0)  
        return 2;  
  
    // iterate from 3 to sqrt(n)  
    for (int i = 3; i * i <= n; i += 2) {  
        if (n % i == 0)  
            return i;  
    }  
  
    return n;  
}  
 static boolean IsP(String s,int l,int r)
 {
      while(l <= r)
      {
          if(s.charAt(l) != s.charAt(r))
          {
              return false;
          }
         l++;
         r--;
      }
      return true;
 }
  
	

    
    
 static class Student{
    int id;
    int val;
     Student(int id,int val)
     {
      this.id = id;
      this.val = val;
     }
 }
   
   
   
 
     static int upperBound(ArrayList<Integer> a, int low, int high, int element){
    while(low < high){
        int middle = low + (high - low)/2;
        if(a.get(middle) >= element)
            high = middle;
        else 
            low = middle + 1;
    }
    return low;
}
   static long func(long t,long e,long h,long a, long b)
   {
       if(e*a >= t)
           return t/a;
       else
       {
           return e + Math.min(h,(t-e*a)/b);
       }
   }
         
      
   
    public static int countSetBits(int number){
        int count = 0;
        while(number>0){
            ++count;
            number &= number-1;
        }
        return count;
    }
    
     
      
 
    
   
     static long modexp(long x,long n,long M)
{
    long power = n;
    long result=1;
    x = x%M;
    while(power>0)
    {
        if(power % 2 ==1)
            result=(result * x)%M;
        x=(x*x)%M;
        power = power/2;
    }
    return result;
}
      static long modInverse(long A,long M)
{
    return modexp(A,M-2,M);
}
    static long gcd(long a,long b)
    {
        if(a==0)
            return b;
        else
            return gcd(b%a,a);
    }
    static class Temp{
        int a;
        int b;
        int c;
        int d;
      
        Temp(int a,int b,int c,int d)
        {
            this.a = a;
            this.b = b;
            this.c  =c;
            this.d = d;
            //this.d = d;
        }
    }
   
    
    
   static long sum1(int t1,int t2,int x,int []t)
   {
       int mid = (t2-t1+1)/2;
  if(t1==t2)
      return 0;
    
   else
   return sum1(t1,mid-1,x,t) + sum1(mid,t2,x,t);
    
     
   }
  
   
    static String replace(String s,int a,int n)
    {
        char []c = s.toCharArray();
        for(int i=1;i<n;i+=2)
        {
            int num = (int) (c[i] - 48);
            num += a;
            num%=10;
            c[i] = (char) (num+48);
        }
        return new String(c);
    }
    static String move(String s,int h,int n)
    {
        h%=n;
        char []c = s.toCharArray();
        char []temp = new char[n];
        for(int i=0;i<n;i++)
        {
            temp[(i+h)%n] = c[i];
        }
        return new String(temp);
    }
    
     public static int ip(String s){
return Integer.parseInt(s);
}
     static class multipliers implements Comparator<Long>{
  
         
  public int compare(Long a,Long b) {
   if(a<b)
    return 1;
   else if(b<a)
    return -1;
   else
    return 0;
  }
 }
     
     static class multipliers1 implements Comparator<Coin>{
  
  public int compare(Coin a,Coin b) {
   if(a.a < b.a)
       return 1;
   else if(a.a > b.a)
       return -1;
   else{ 
       if(a.b < b.b)
       return 1;
   else if(a.b > b.b)
       return -1;
       else
       return 0;
   }
       
  
 
     }
     }
     
// Java program to generate power set in 
// lexicographic order. 
 
    
    
    
      static class InputReader {
 
private final InputStream stream;
private final byte[] buf = new byte[8192];
private int curChar, snumChars;
 
public InputReader(InputStream st) {
this.stream = st;
}
 
public int read() {
if (snumChars == -1)
throw new InputMismatchException();
if (curChar >= snumChars) {
curChar = 0;
try {
snumChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (snumChars <= 0)
return -1;
}
return buf[curChar++];
}
 
public int ni() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
 
public long nl() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
long res = 0;
do {
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
 
public int[] nia(int n) {
int a[] = new int[n];
for (int i = 0; i < n; i++) {
a[i] = ni();
}
return a;
}
 
public String rs() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
 
public String nextLine() {
int c = read();
while (isSpaceChar(c))
c = read();
StringBuilder res = new StringBuilder();
do {
res.appendCodePoint(c);
c = read();
} while (!isEndOfLine(c));
return res.toString();
}
 
public boolean isSpaceChar(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
 
private boolean isEndOfLine(int c) {
return c == '\n' || c == '\r' || c == -1;
}
 
}
 
 
 
 
 
   
static PrintWriter w = new PrintWriter(System.out);
                  static class Student1
    {
        int id;
        //int x;
       
       int b;
      
        //long z;
        
        Student1(int id,int b)
        {
            this.id = id;
            //this.x = x;
            //this.s = s;
            this.b = b;
          
           // this.z = z;
            
            
            
           
        }
        
    }
}