#include <bits/stdc++.h>
using namespace std;
const int dir[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
const int NM = 1e3 + 10;
map<int, vector<pair<int, int> > > val;
pair<int, int> parent[NM][NM];
int n, m, a[NM][NM], weight[NM][NM], qtd[NM][NM];
bool mark[NM][NM];
pair<int, int> find(pair<int, int> x) {
  int i = x.first, j = x.second;
  if (parent[i][j] == x) return x;
  return parent[i][j] = find(parent[i][j]);
}
void join(pair<int, int> a, pair<int, int> b) {
  a = find(a), b = find(b);
  if (a == b) return;
  int ai = a.first, aj = a.second;
  int bi = b.first, bj = b.second;
  if (weight[ai][aj] < weight[bi][bj])
    swap(ai, bi), swap(aj, bj);
  else if (weight[ai][aj] == weight[bi][bj])
    weight[ai][aj]++;
  parent[bi][bj] = make_pair(ai, aj);
  qtd[ai][aj] += qtd[bi][bj];
}
int dfs(int x, int y, int max_qtd, int menor) {
  if (mark[x][y]) return 0;
  mark[x][y] = true;
  int ja = 1;
  for (int k = 0; k < 4; k++) {
    int nx = x + dir[k][0], ny = y + dir[k][1];
    if (nx >= 1 && nx <= n && ny >= 1 && ny <= m) {
      if (a[nx][ny] >= menor && ja < max_qtd) {
        ja += dfs(nx, ny, max_qtd - ja, menor);
      }
    }
  }
  return ja;
}
int main() {
  long long k;
  scanf("%d %d %lld", &n, &m, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      parent[i][j] = make_pair(i, j);
      weight[i][j] = 0;
      qtd[i][j] = 1;
    }
  }
  vector<int> all;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
      val[a[i][j]].push_back(make_pair(i, j));
      all.push_back(a[i][j]);
    }
  }
  sort(all.rbegin(), all.rend());
  all.resize(unique(all.begin(), all.end()) - all.begin());
  int ans = 0;
  for (int i = 0; i < all.size(); i++) {
    ;
    bool ok = false;
    int len = val[all[i]].size();
    for (int j = 0; j < len; j++) {
      int x = val[all[i]][j].first, y = val[all[i]][j].second;
      for (int k = 0; k < 4; k++) {
        int nx = x + dir[k][0], ny = y + dir[k][1];
        if (nx >= 1 && nx <= n && ny >= 1 && ny <= m) {
          if (a[nx][ny] >= a[x][y]) {
            join(make_pair(x, y), make_pair(nx, ny));
          }
        }
      }
      pair<int, int> p = find(make_pair(x, y));
      if (k % all[i] == 0 && k / all[i] <= qtd[p.first][p.second]) {
        ans = all[i];
        dfs(x, y, k / all[i], all[i]);
        ok = true;
        break;
      }
    }
    if (ok) break;
  }
  if (!ans) {
    printf("NO\n");
  } else {
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) {
        if (!mark[i][j]) {
          printf("0 ");
        } else {
          printf("%d ", ans);
        }
      }
      printf("\n");
    }
  }
  return 0;
}
