#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long long N = 1000 + 5, L = 12, inf = LLONG_MAX;
long long n, m, k;
long long a[N][N], par[N * N], sz[N * N], res[N][N], hh, cnt;
bool mark[N][N], vis[N][N];
long long mp[N * N];
vector<pair<long long, long long> > vec, all;
set<long long> s;
long long H[] = {0, 0, -1, 1};
long long G[] = {1, -1, 0, 0};
inline void er(long long x) {
  mp[x]--;
  if (mp[x] == 0) {
    s.erase(-x);
  }
  return;
}
inline void ad(long long x) {
  mp[x]++;
  if (mp[x] == 1) {
    s.insert(-x);
  }
  return;
}
long long find(long long a) {
  if (par[a] == a) return a;
  return par[a] = find(par[a]);
}
inline void _union(long long a, long long b) {
  a = find(a);
  b = find(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  er(sz[a]);
  er(sz[b]);
  par[b] = a;
  sz[a] += sz[b];
  ad(sz[a]);
  return;
}
void dfs(long long x, long long y) {
  vis[x][y] = 1;
  all.push_back({x, y});
  for (long long k = 0; k < 4; k++) {
    long long i = x + H[k], j = y + G[k];
    if (i >= 0 && j >= 0 && i < n && j < m) {
      if (!vis[i][j] && a[i][j] >= hh) {
        dfs(i, j);
      }
    }
  }
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(nullptr);
  cout.tie(nullptr);
  ;
  cin >> n >> m >> k;
  for (long long i = 0; i < n * m; i++) par[i] = i, sz[i] = 1;
  s.insert(-1);
  mp[1] = n * m;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
      vec.push_back({a[i][j], i * m + j});
    }
  sort(vec.begin(), vec.end(), greater<pair<long long, long long> >());
  long long ans = -1, xx = -1, yy = -1;
  for (auto p : vec) {
    long long x = p.second / m, y = p.second % m, h = p.first;
    mark[x][y] = 1;
    for (long long k = 0; k < 4; k++) {
      long long i = x + H[k], j = y + G[k];
      if (i >= 0 && j >= 0 && i < n && j < m && mark[i][j]) {
        _union(i * m + j, p.second);
      }
    }
    if (k % h == 0) {
      long long mx = sz[find(p.second)];
      if (mx >= k / h) {
        ans = mx;
        hh = h;
        xx = x;
        yy = y;
        break;
      }
    }
  }
  if (ans == -1) return cout << "NO\n", 0;
  dfs(xx, yy);
  cout << "YES\n";
  long long sum = 0;
  for (auto p : all) {
    res[p.first][p.second] = hh;
    sum += hh;
    if (sum == k) break;
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cout << res[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}
