显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
freopen("thupc_2025_trilink.in", "r", stdin);
freopen("thupc_2025_trilink.out", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
if(k>(2*n)/3 or k<(n+1)/2)cout<<"No"<<endl;
else{
cout<<"Yes"<<endl;
int y=2*k-n;
int x=k-2*y;
string s0[2],s1[3];
s0[0]="##.";
s0[1]="..#";
s1[0]="##.";
s1[1]="#.#";
s1[2]=".##";
for(int i=1;i<=x;i++){
for(int k=0;k<=1;k++){
for(int j=0;j<n;j++){
cout<<s0[k][j%3];
}
cout<<endl;
}
}
for(int i=1;i<=y;i++){
for(int k=0;k<=2;k++){
for(int j=0;j<n;j++){
cout<<s1[k][j%3];
}
cout<<endl;
}
}
}
}
}