/*
_...---.._
,' ~~"--..
/ ~"-._
/ ~-.
/ . `-.
\ -.\ `-.
\ ~-. `-.
,-~~\ ~.
/ \ `.
. \ `.
| \ .
| \ \
. `. \
\ \
` `. \
` \. \
` \`. \
. \ -. \
` -. \
. ` - \ .
` \ ~- \
` . ~. \
. \ -_ \
` - \
. | ~. \
` | \ \
. | \ \
` | `. \
` ` \ \
. . `. `.
` : \ `.
\ ` \ `.
\ . `. `~~-.
\ : ` \ \
. . \ : `.\
` : \ | | .
\ . \ | |
\ : \ ` | `
. . | |_ .
` `. ` ` | ~.;
\ `. . . .
. `. ` ` `
`. `._. \ `.\
` < \ `. | .
` ` : ` | |
` \ ` | |
`. | \ : .' |
"Are you crying? " ` | \ `_-' |
"It's only the rain." : | | | : ;
"The rain already stopped."` ; |~-.| : '
"Devils never cry." : \ | ` ,
` \` : '
: \` `_/
` .\ "For we have none. Our enemy shall fall."
` ` \ "As we apprise. To claim our fate."
\ | : "Now and forever. "
\ .' : "We'll be together."
: : "In love and in hate"
| .'
| : "They will see. We'll fight until eternity. "
| ' "Come with me.We'll stand and fight together."
| / "Through our strength We'll make a better day. "
`_.' "Tomorrow we shall never surrender."
sao xin*/
#include <vector>
#include <iostream>
#include <string>
#include <map>
#include <stack>
#include <cstring>
#include <queue>
#include <list>
#include <cstdio>
#include <set>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <cctype>
#include <sstream>
#include<functional>
#define INF 0xfffffff
#define eps 1e-6
#define LL long long
using namespace std;
const int maxn=1e3+5;
const int maxx=1e4+5;
//const double q = (1 + sqrt(5.0)) / 2.0; // 黄金分割数
/*
std::hex <<16进制 cin>>std::hex>>a>>std::hex>>b
cout.setf(ios::uppercase);cout<<std::hex<<c<<endl;
b=b>>1; 除以2 二进制运算
//f[i]=(i-1)*(f[i-1]+f[i-2]); 错排
/ for (int i=1; i<=N; i++)
for (int j=M; j>=1; j--)
{
if (weight[i]<=j)
{
f[j]=max(f[j],f[j-weight[i]]+value[i]);
}
}
priority_queue<int,vector<int>,greater<int> >que3;//注意“>>”会被认为错误,
priority_queue<int,vector<int>,less<int> >que4;////最大值优先
//str
//tmp
//vis
//val
//cnt 2486 hdu 3790最短路径
*/
int dx[8] = {-1, 1, -2, 2, -2, 2, -1, 1};
int dy[8] = {-2, -2, -1, -1, 1, 1, 2, 2};
int mapp[maxn][maxn];
int vis[maxn][maxn];
int q,p;
int flag;
int check(int x,int y)
{
if(x>=1&&x<=p&&y>=1&&y<=q&&!vis[x][y]&&!flag)
return 1;
return 0;
}
void DFS(int x,int y,int z)
{
mapp[z][0]=x;
mapp[z][1]=y;
if(z==q*p)
{
flag=1;
return ;
}
for(int i=0;i<8;i++)
{
int hx=x+dx[i];
int hy=y+dy[i];
if(check(hx,hy))
{
vis[hx][hy]=1;
DFS(hx,hy,z+1);
vis[hx][hy]=0;
}
}
}
void solve()
{
int n;
cin>>n;
int num=0;
while(n--)
{
flag=0;
cin>>p>>q;
printf("Scenario #%d:\n",++num);
memset(vis,0,sizeof(vis));
vis[1][1]=1;
DFS(1,1,1);
if(flag)
{
for(int i=1;i<=p*q;i++)
printf("%c%d",mapp[i][1] - 1 + 'A',mapp[i][0]);
}
else
cout<<"impossible";
cout<<endl;
if(n!=0)
cout<<endl;
}
}
int main()
{
solve();
}