Code: Select all
#include<stdio.h>
int main()
{
int t,n,f;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&f);
for(int l=0;l<f;l++)
{
for(int j=1;j<=n;j++)
{
for(int k=0;k<j;k++)
{
printf("%d",j);
}
printf("\n");
}
for(int m=n-1;m>0;m--)
{
for(int h=0;h<m;h++)
{
printf("%d",m);
}
printf("\n");
}
if(l<f-1)
{
printf("\n");
}
}
}
return 0;
}