#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<iostream>
#include<cstring>
#define dfsnext if(y==n) dfs(x+1,1);else dfs(x,y+1)
std::string ak,bk;
int n,rowhave[6][3],colhave[6][3];
char colfirst[6],rowfirst[6],a[6][6];
bool check(int x,int y)
{
memset(rowhave,0,sizeof(rowhave));
memset(colhave,0,sizeof(colhave));
memset(colfirst,0,sizeof(colfirst));
memset(rowfirst,0,sizeof(rowfirst));
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
if(a[i][j]&&a[i][j]!='.')
{
rowhave[i][a[i][j]-'A']++;
colhave[j][a[i][j]-'A']++;
if(!rowfirst[i]) rowfirst[i]=a[i][j];
if(!colfirst[j]) colfirst[j]=a[i][j];
}
for(int i=1;i<=n;i++)
if(rowfirst[i]!=ak[i-1]&&rowfirst[i]!=0) return 0;
for(int i=1;i<=n;i++)
if(colfirst[i]!=bk[i-1]&&colfirst[i]!=0) return 0;
for(int i=1;i<=x-1;i++)
for(int j=0;j<3;j++)
if(rowhave[i][j]!=1) return 0;
if(x==5)
{
for(int i=1;i<=y-1;i++)
for(int j=0;j<3;j++)
if(colhave[i][j]!=1) return 0;
}
return 1;
}
void dfs(int x,int y)
{
// for(int i=1;i<=n;i++)
// {
// for(int j=1;j<=n;j++) putchar(a[i][j]);
// puts("");
// }
if(!check(x,y)) return;
if(x==n+1)
{
puts("Yes");
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++) putchar(a[i][j]);
puts("");
}
exit(0);
}
a[x][y]='A';
dfsnext;
a[x][y]='B';
dfsnext;
a[x][y]='C';
dfsnext;
a[x][y]='.';
dfsnext;
a[x][y]=0;
}
int main()
{
scanf("%d",&n);
std::cin>>ak>>bk;
dfs(1,1);
puts("No");
return 0;
}