#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 9, N = 1e3 + 9;
const int qwer[] = {-1, 0, 1, 0}, asdf[] = {0, 1, 0, -1};
int n, m, a[N][N], arr[MAX], sizee[MAX], number, c[N][N], vv, cnt;
long long k;
struct node {
  int id, x, y;
} b[MAX];
int root(int x) { return x == arr[x] ? x : arr[x] = root(arr[x]); }
void merge(int x, int y) {
  int zxcv = root(x), fy = root(y);
  if (sizee[zxcv] < sizee[fy]) swap(zxcv, fy);
  if (zxcv == fy) return;
  arr[fy] = zxcv;
  sizee[zxcv] += sizee[fy];
}
bool cmp(const node& x, const node& y) { return x.id > y.id; }
void dfs(int x, int y) {
  if (c[x][y]) return;
  if (number)
    c[x][y] = vv, number--;
  else
    return;
  for (int i = 0; i < 4; i++) {
    int nx = x + qwer[i];
    int ny = y + asdf[i];
    if (nx < 1 || nx > n || ny < 1 || ny > m) continue;
    if (a[nx][ny] < vv) continue;
    dfs(nx, ny);
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      cin >> a[i][j], cnt++, b[cnt].x = i, b[cnt].y = j, b[cnt].id = a[i][j];
  sort(b + 1, b + cnt + 1, cmp);
  for (int i = 1; i <= cnt; i++) arr[i] = i, sizee[i] = 1;
  int i;
  for (i = 1; i <= cnt; i++) {
    int dd = (b[i].x - 1) * m + b[i].y;
    for (int j = 0; j < 4; j++) {
      int nx = b[i].x + qwer[j];
      int ny = b[i].y + asdf[j];
      if (nx < 1 || nx > n || ny < 1 || ny > m || a[nx][ny] < b[i].id) continue;
      merge(dd, (nx - 1) * m + ny);
    }
    if (k % b[i].id == 0 && sizee[root(dd)] >= k / b[i].id) break;
  }
  if (i > cnt) return cout << "NO", 0;
  vv = b[i].id, number = k / b[i].id, dfs(b[i].x, b[i].y);
  cout << "YES\n";
  for (int i = 1; i <= n; i++, cout << '\n')
    for (int j = 1; j <= m; j++) cout << c[i][j] << ' ';
  return 0;
}
