#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int n;
int wk[8][2] = { {1,0},{-1,0},{0,-1},{0,1},{1,1},{1,-1},{-1,1},{-1,-1} };
char qo[200][200];
int qo1[200][200];
char ans[8] = "yizhong";
bool dfs(int x, int y, int dir, int c) {
if (c == 7) return true;
int nx = x + wk[dir][0];
int ny = y + wk[dir][1];
if (nx >= 1 && nx <= n && ny >= 1 && ny <= n && qo[nx][ny] == ans[c]) {
qo1[nx][ny] = 1;
if (dfs(nx, ny, dir, c + 1)) return true;
qo1[nx][ny] = 0;
}
return false;
}
int main()
{
cin >> n;
memset(qo1, 0, sizeof(qo1));
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
scanf(" %c", &qo[i][j]);
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (qo[i][j] == 'y')
{
for (int z = 0; z < 8; z++)
{
if (dfs(i, j, z, 1)) {
qo1[i][j] = 1;
}
}
}
}
}
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (qo1[i][j] == 0)
{
printf("%c", '*');
}
else
{
printf("%c", qo[i][j]);
}
}
printf("\n");
}
return 0;
}