#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 1000;
long long par[maxn], sz[maxn];
bool mark[maxn];
long long n, m, x, k;
long long root(long long x) { return par[x] == x ? x : par[x] = root(par[x]); }
void merge(long long u, long long v) {
  u = root(u);
  v = root(v);
  if (v == u) {
    return;
  }
  if (sz[u] > sz[v]) {
    sz[u] += sz[v];
    par[v] = u;
  } else {
    sz[v] += sz[u];
    par[u] = v;
  }
}
bool check(long long x, long long d) {
  x = root(x);
  return sz[x] >= k / d;
}
long long ans[maxn];
long long val, cnt, p;
bool vst[maxn];
void dfs(int cur) {
  vst[cur] = 1;
  if (cnt) {
    ans[cur] = val;
  } else {
    return;
  }
  cnt--;
  if (cur > 1 && ((cur - 1) % m) != 0 && root(cur - 1) == p && !vst[cur - 1]) {
    dfs(cur - 1);
  }
  if (cur < n * m && ((cur + 1) % m) != 1 && root(cur + 1) == p &&
      !vst[cur + 1]) {
    dfs(cur + 1);
  }
  if (cur - m >= 1 && root(cur - m) == p && !vst[cur - m]) {
    dfs(cur - m);
  }
  if (cur + m <= n * m && root(cur + m) == p && !vst[cur + m]) {
    dfs(cur + m);
  }
}
void print(long long x, long long d) {
  p = root(x);
  cout << "YES\n";
  cnt = k / d;
  val = d;
  dfs(x);
  for (long long i = 1; i <= n * m; i++) {
    if (i % m == 1 && i > 1) {
      cout << '\n';
    }
    cout << ans[i] << ' ';
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m >> k;
  for (long long i = 1; i <= n * m; i++) {
    par[i] = i;
    sz[i] = 1;
    mark[i] = 0;
  }
  vector<pair<long long, long long>> a;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> x;
      long long l = (i - 1) * m + j;
      a.push_back(make_pair(x, l));
    }
  }
  sort(a.rbegin(), a.rend());
  for (auto y : a) {
    long long l = y.second;
    mark[l] = 1;
    if (((l - 1) % m) != 0 && mark[l - 1]) {
      merge(l, l - 1);
    }
    if (((l + 1) % m) != 1 && mark[l + 1]) {
      merge(l, l + 1);
    }
    if (l - m >= 1 && mark[l - m]) {
      merge(l, l - m);
    }
    if (l + m <= n * m && mark[l + m]) {
      merge(l, l + m);
    }
    if (k % (y.first) == 0) {
      if (check(l, y.first)) {
        print(l, y.first);
        return 0;
      }
    }
  }
  cout << "NO";
}
