#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<queue>
const int maxn = 100;
using namespace std;
int n,a,b,flag;
int vis[maxn][maxn];
int dx[] = {-1,1,-2,2,-2,2,-1,1};
int dy[] = {-2,-2,-1,-1,1,1,2,2};
struct node{
int c;
int r;
}e[1000];
void solve(int x,int y,int cnt){
for(int i = 0 ; i < 8 ; i++){
int xx = dx[i] + x;
int yy = dy[i] + y;
if(xx < 0 || xx >= a || yy < 0 || yy >= b || vis[xx][yy] ||flag) continue;
vis[xx][yy] = 1;
e[cnt].c = xx;
e[cnt].r = yy;
solve(xx,yy,cnt+1);
vis[xx][yy] = 0;
}
if(cnt == a*b){
flag = 1;
return;
}
}
int main(){
scanf("%d",&n);
for(int i = 0 ; i < n ; i++){
memset(e,0,sizeof(e));
memset(vis,0,sizeof(vis));
flag = 0;
e[1].c = 0;
e[1].r = 0;
vis[0][0] = 1;
scanf("%d%d",&a,&b);
solve(0,0,1);
printf("Scenario #%d:\n",i + 1);
if(flag){
for(int j = 0 ; j < a*b ; j++)
printf("%c%d",e[j].r + 65,e[j].c + 1);
printf("\n");
}
else printf("impossible\n");
printf("\n");
}
return 0;
}