#include <iostream>
using namespace std;
const int N = 30;
int n, p, q;
bool res[N][N];
bool succ;
int dx[8] = {1, 1, -1, -1, 2, 2, -2, -2};
int dy[8] = {2, -2, 2, -2, 1, -1, 1, -1};
struct Loc
{
int x;
char y;
}loc[N];
void dfs(int a, int b, int idx)
{
loc[idx].x = a;
loc[idx].y = b + 'A' - 1;
if(idx == p * q)
{
succ = 1;
}
for(int i = 0; i < 8; i++)
{
int x = a + dx[i], y = b + dy[i];
if(x > 0 && x <= p && y > 0 && y <= q && res[x][y] == 0)
{
res[x][y] = 1;
dfs(x, y, idx + 1);
res[x][y] = 0;
}
}
}
int main()
{
cin >> n;
for(int i = 1; i <= n; i++)
{
cin >> p >> q;
for(int i = 0; i < N; i++)
{
for(int j = 0; j < N; j++)
{
res[i][j] = 0;
}
}
res[1][1] = 1;
succ = 0;
dfs(1, 1, 1);
cout << "Scenario #" << i << ":" << endl;
if(succ == 1)
{
for(int i = 1; i <= p * q; i++)
{
cout << loc[i].y << loc[i].x ;
}
cout << endl;
}
else
{
cout << "impossible" << endl;
}
if(i != n) cout << endl;
}
return 0;
}