#include<iostream>
#define NUM 500
using namespace std;
char str[] = "yizhong";
char a[NUM][NUM];
int s[NUM][NUM] = { 0 };
int dx[] = { -1,-1,-1,0,0,1,1,1,0 };
int dy[] = { -1,0,1,1,-1,-1,0,1,0 };
bool dfs(int i, int j, int next) {
if (next >= 8) {
return 1;
}
if (a[i][j] == str[next]) {
for (int a = 0; a < 10; a++) {
if (dfs(i + dx[a], j + dy[a], next + 1)) {
s[i][j] = 1;
return 1;
}
}
}
else
return 0;
}
int main() {
int n;
cin >> n;
int ch[NUM][2];
int cnt = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
char x;
cin >> x;
a[i][j] = x;
if (x == 'y') {
ch[cnt][0] = i;
ch[cnt][1] = j;
cnt++;
}
}
}
for (int i = 0; i < cnt; i++) {
dfs(ch[i][0], ch[i][1], 0);
}
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (s[i][j])
cout << a[i][j];
else
cout << '*';
}
cout << endl;
}
}