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
#include <bits/stdc++.h>
using namespace std;
void cinar(int* ar, int n) {
  for (int i = 0; i < n; i++) cin >> ar[i];
}
void out(int* a, int n) {
  for (int i = 0; i < n; i++) {
    cout << a[i] << " ";
  }
}
int max(int a, int b) {
  if (a > b) return a;
  return b;
}
int min(int a, int b) {
  if (a < b) return a;
  return b;
}
int powexp(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) res *= a;
    a *= a;
    b >>= 1;
  }
  return res;
}
int powexp(int a, int b, int m) {
  a %= m;
  int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int modInverse(int a, int p) { return powexp(a, p - 2, p); }
void fast() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int phi(int n) {
  int r = n;
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      r -= r / i;
    }
  }
  if (n > 1) r -= r / n;
  return r;
}
int gcd(int a, int b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
struct tri {
  int a;
  int b;
  int c;
};
long double pu = 3.141592653589793238;
void solve() {
  int n, m, a, b;
  cin >> n >> m >> a >> b;
  if (n * a != m * b) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
    int arr[n][m];
    int st = 0;
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        arr[i][j] = 0;
      }
    }
    for (int i = 0; i < n; i++) {
      for (int j = st; j < st + a; j++) {
        arr[i][j % m] = 1;
      }
      st += a;
    }
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << arr[i][j];
      }
      cout << "\n";
    }
  }
}
int main() {
  fast();
  int t = 1;
  cin >> t;
  while (t--) solve();
}
