#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int n;
char g[N][N];
char word[N];
bool st[N][N];
int dx[8] = {-1, -1, -1, 0, 1, 1, 1, 0};
int dy[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
bool dfs(int x, int y, char c, int dir) {
if (c == 'g') {
st[x][y] = true;
return true;
}
int a = x + dx[dir], b = y + dy[dir];
if (a >= 0 && a < n && b >= 0 && b < n &&
g[a][b] == word[c])
if (dfs(a, b, word[c], dir)) {
st[x][y] = true;
return true;
}
return false;
}
int main() {
//把单词串在一起
// le['y'] = 'i', le['i'] = 'z', le['z'] = 'h';
// le['h'] = 'o', le['o'] = 'n', le['n'] = 'g';
string s = "yizhong";
for (int i = 0; i < 6; i ++ )
word[s[i]] = s[i + 1];
cin >> n;
for (int i = 0; i < n; i ++ ) cin >> g[i];
for (int i = 0; i < n; i ++ )
for (int j = 0; j < n; j ++ )
if (g[i][j] == 'y')
for (int k = 0; k < 8; k ++ )
if (dfs(i, j, 'y', k))
st[i][j] = true;
for (int i = 0; i < n; i ++ ) {
for (int j = 0; j < n; j ++ )
if (st[i][j]) cout << g[i][j];
else cout << '*';
cout << endl;
}
return 0;
}