#include <bits/stdc++.h>   const int inf = (int)1e9;   const int mod = 1e9 + 7;   using namespace std;   long long a[1011][1011];   int n, m;   int id[1000011];   long long k;   int d[1000011];   int c[1011][1011];   int now = 0;   vector<pair<long long, pair<int, int> > > b;   bool cmp(pair<long long, pair<int, int> > a,            pair<long long, pair<int, int> > b) {     return a.first > b.first;   }   int get(int x) {     if (d[x] == x) {       return x;     }     return get(d[x]);   }   void unite(int x, int y) {     x = get(x);     y = get(y);     if (x == y) {       return;     }     if (id[x] <= id[y]) {       d[x] = y;       id[y] += id[x];     } else {       d[y] = x;       id[x] += id[y];     }   }   void rec(int x, int y, int cnt, int mn) {     if (now >= cnt) {       return;     }     now++;     c[x][y] = mn;     if (a[x - 1][y] >= mn && c[x - 1][y] == 0) {       rec(x - 1, y, cnt, mn);     }     if (a[x + 1][y] >= mn && c[x + 1][y] == 0) {       rec(x + 1, y, cnt, mn);     }     if (a[x][y + 1] >= mn && c[x][y + 1] == 0) {       rec(x, y + 1, cnt, mn);     }     if (a[x][y - 1] >= mn && c[x][y - 1] == 0) {       rec(x, y - 1, cnt, mn);     }   }   int main() {     ios_base::sync_with_stdio(0);     cin.tie(0);     cin >> n >> m >> k;     for (int i = 1; i <= n; i++) {       for (int j = 1; j <= m; j++) {         cin >> a[i][j];         b.push_back(make_pair(a[i][j], make_pair(i, j)));         d[(i - 1) * m + j] = (i - 1) * m + j;         id[(i - 1) * m + j] = 1;       }     }     sort(b.begin(), b.end(), &cmp);     for (int x = 0; x < b.size(); x++) {       int i = b[x].second.first, j = b[x].second.second;       if (a[i - 1][j] >= a[i][j]) {         unite((i - 1) * m + j, (i - 2) * m + j);       }       if (a[i + 1][j] >= a[i][j]) {         unite((i - 1) * m + j, (i)*m + j);       }       if (a[i][j + 1] >= a[i][j]) {         unite((i - 1) * m + j, (i - 1) * m + j + 1);       }       if (a[i][j - 1] >= a[i][j]) {         unite((i - 1) * m + j, (i - 1) * m + j - 1);       }       if (k % a[i][j] == 0) {         if (id[get((i - 1) * m + j)] >= k / a[i][j]) {           cout <<  YES  << endl;           rec(i, j, k / a[i][j], a[i][j]);           for (int k = 1; k <= n; k++) {             for (int l = 1; l <= m; l++) {               cout << c[k][l] <<    ;             }             cout << endl;           }           return 0;         }       }     }     cout <<  NO ;     return 0;   }   