import java.io.*;
public class Main{
static int N = 110,n;
static char[][] g = new char[N][N];
static char[] goal = {'y','i','z','h','o','n','g'};
static int[][] vis = new int[N][N];
static int[][] dis = {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
static PII[] c = new PII[N];
public static void dfs(int x,int y,int k,int cnt){
if(cnt == 7){
for(int i = 0 ; i < 7 ; i ++ )
vis[c[i].x][c[i].y] = 1;
}else{
int tx = x + dis[k][0];
int ty = y + dis[k][1];
if(tx < 0 || tx > n || ty < 0 || ty > n ){
return;
}
if(cnt == 6 || g[tx][ty] == goal[cnt + 1] ){
c[cnt] = new PII(x,y);
dfs(tx,ty,k,cnt + 1);
}
}
}
public static void main(String[] args)throws IOException{
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(bf.readLine());
for(int i = 0 ; i < n ; i ++ ){
String st = bf.readLine();
char[] ch = st.toCharArray();
for(int j = 0 ; j < n ; j ++ )
g[i][j] = ch[j];
}
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 ++ ){
int x = i + dis[k][0];
int y = j + dis[k][1];
if(x >= 0 && x <= n && y >= 0 && y <= n ){
if(g[x][y] == 'i'){
dfs(i,j,k,0);
}
}
}
}
}
}
for(int i = 0 ; i < n ; i ++ ){
for(int j = 0 ; j < n ; j ++ ){
if(vis[i][j] == 1) System.out.print(g[i][j]);
else System.out.print("*");
}
System.out.println();
}
}
}
class PII{
int x,y;
public PII(int x,int y){
this.x = x;
this.y = y;
}
}
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn=100+10;
struct node
{
int x,y;
}c[maxn];
char fz[maxn][maxn],stand[]="yizhong";
int vis[maxn][maxn];
int dir[][2]={{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
void dfs(int x,int y,int k,int cur)
{
if(cur==7){
for(int i=0;i<7;i++)
vis[c[i].x][c[i].y]=1;
}
else{
int dx=x+dir[k][0];
int dy=y+dir[k][1];
if(cur==6||fz[dx][dy]==stand[cur+1]){
c[cur].x=x;c[cur].y=y;
dfs(dx,dy,k,cur+1);
}
}
}
int main()
{
int n;
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%s",fz[i]);
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
if(fz[i][j]=='y') for(int k=0;k<8;k++){
int x=i+dir[k][0];
int y=j+dir[k][1];
if(fz[x][y]=='i')
dfs(i,j,k,0);
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
if(vis[i][j]) printf("%c",fz[i][j]);
else printf("*");
printf("\n");
}
return 0;
}