import java.io.IOException;
import java.util.Scanner;
public class PBM {
private int[][] bits;
private int rows,columns;
PBM() throws IOException{
Scanner sc =
new Scanner(System.in);
if (!sc.next().equals("P1"))
throw new IOException("Format error");
columns=sc.nextInt();
rows=sc.nextInt();
bits=new int[rows][columns];
for (int i=0; i< rows; i++){
String line=sc.next();
for (int j=0; j<columns; j++)
bits[i][j]=line.charAt(j)-'0';
}
}
public String toString(){
String result="";
for (int i=0; i< rows; i++){
for (int j=0; j<columns; j++){
if (bits[i][j]==1)
result += "*";
else
result += " ";
}
result +="\n";
}
return result;
}
public static void main(String [] args) throws IOException{
PBM pbm = new PBM();
System.out.println(pbm);
}
}
//