https://www.luogu.com.cn/record/196033610
#include<bits/stdc++.h>
using namespace std;
#define LL long long
const int N = 2e4+5;
LL n,m,l,r;
char a[N][N];
int main()
{
// freopen("in.in","r",stdin);
// freopen("out.out","w",stdout);
int T; scanf("%d",&T);
while(T--)
{
scanf("%lld%lld%lld%lld",&l,&r,&n,&m);
if(n>m) swap(n,m);
for(int i=0;i<=n;i++)
for(int j=0;j<=m;j++) a[i][j]='c';
// if(n==0||m==0) puts("Yes");
queue<pair<LL,LL> > q;
q.push({n,m});
while(!q.empty())
{
LL x=q.front().first,y=q.front().second; q.pop();
a[x][y]='a';
for(int i=l;i<=r;i++)
{
if(x-i<0||y-i<0) break;
a[x-i][y-i]='b';
}
if(x-1>=0&&a[x-1][y]!='b'&&(!(y>=m-l&&x==n-l+1))) q.push({x-1,y});
else if(y-1>=0&&a[x][y-1]!='b') q.push({x,y-1});
}
if(a[0][0]=='a') puts("Yes");
else puts("No");
for(int i=n;i>=0;i--)
{
for(int j=0;j<=m;j++) printf("%c ",a[i][j]); putchar('\n');
}
putchar('\n');
}
return 0;
}