#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
int n, m;
long long k;
int a[N], h[N], root[N], size[N];
inline int f(int x) {
  if (x == root[x]) return x;
  return root[x] = f(root[x]);
}
inline void merge(int x, int y) {
  x = f(x);
  y = f(y);
  root[y] = x;
  if (x != y) size[x] += size[y];
}
vector<int> way;
inline bool pos(int a, int b) {
  return b > 0 and b <= n * m and
         abs((a - 1) / m - (b - 1) / m) + abs((a - 1) % m - (b - 1) % m) == 1;
}
void add(int x) {
  h[x] = 1;
  for (auto go : way) {
    go += x;
    if (pos(x, go) and h[go]) merge(x, go);
  }
}
void solve(int i, int to) {
  puts("YES");
  vector<int> Q;
  Q.push_back(i);
  memset(h, 0, sizeof(h));
  h[i] = 1;
  for (int it = 0; it < Q.size(); it++) {
    int x = Q[it];
    for (auto go : way) {
      go += x;
      if (pos(x, go) and !h[go] and a[go] >= to) {
        h[go] = 1;
        Q.push_back(go);
      }
    }
  }
  memset(a, 0, sizeof(a));
  for (int it = 0; it < k / to; it++) {
    int x = Q[it];
    a[x] = to;
  }
  for (int i = 1; i <= n * m; i++) {
    printf("%d ", a[i]);
    if (i % m == 0) puts("");
  }
}
int main() {
  scanf("%d %d %lld", &n, &m, &k);
  way = {-1, +1, -m, +m};
  vector<pair<int, int> > vs;
  for (int i = 1; i <= n * m; i++) {
    scanf("%d", a + i);
    vs.push_back({a[i], i});
    root[i] = i;
    size[i] = 1;
  }
  sort(vs.begin(), vs.end());
  for (int x = 1; x <= n * m; x++) {
    if (k % x == 0) {
      long long to = k / x;
      vector<int> p;
      while (vs.size() and vs.back().first >= to) {
        if (vs.back().first == to) p.push_back(vs.back().second);
        add(vs.back().second);
        vs.pop_back();
      }
      for (auto i : p) {
        if (size[f(i)] >= x) {
          solve(i, to);
          return 0;
        }
      }
    }
  }
  puts("NO");
  return 0;
}
