#include <cstdio>
#include<iostream>
using namespace std;
int main(){
int n,m,min,max,gray;
cin>>m>>n>>min>>max>>gray;
for (int i = 0; i <m ; ++i) {
for (int j = 0; j <n ; ++j) {
int a;
scanf("%d",&a);
if(j!=0) printf(" ");
if(a>=min&&a<=max){
a=gray;
}
printf("%03d",a);
}
printf("\n");
}
return 0;
}
08-16
08-16