#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int p[N * N], sz[N * N];
int get_root(int v) { return p[v] == -1 ? v : p[v] = get_root(p[v]); }
void unite(int a, int b) {
  a = get_root(a);
  b = get_root(b);
  if (a == b) return;
  if (sz[a] < sz[b]) swap(a, b);
  p[b] = a;
  sz[a] += sz[b];
}
int mat[N][N];
int used[N][N];
int ans[N][N];
int cou;
int n, m;
void dfs(int x, int y) {
  cou--;
  ans[x][y] = 1;
  if (!cou) return;
  if (x > 0 && used[x - 1][y] && !ans[x - 1][y]) dfs(x - 1, y);
  if (!cou) return;
  if (x + 1 < n && used[x + 1][y] && !ans[x + 1][y]) dfs(x + 1, y);
  if (!cou) return;
  if (y > 0 && used[x][y - 1] && !ans[x][y - 1]) dfs(x, y - 1);
  if (!cou) return;
  if (y + 1 < m && used[x][y + 1] && !ans[x][y + 1]) dfs(x, y + 1);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(p, 255, sizeof(p));
  long long k;
  cin >> n >> m >> k;
  vector<pair<int, pair<int, int> > > v;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> mat[i][j];
      v.emplace_back(mat[i][j], make_pair(i, j));
    }
  }
  sort(v.begin(), v.end());
  for (int i = v.size() - 1; i >= 0; i--) {
    int x = v[i].second.first, y = v[i].second.second;
    used[x][y] = 1;
    int c = x * m + y;
    sz[c] = 1;
    if (x > 0 && used[x - 1][y]) unite(c, c - m);
    if (x + 1 < n && used[x + 1][y]) unite(c, c + m);
    if (y > 0 && used[x][y - 1]) unite(c, c - 1);
    if (y + 1 < m && used[x][y + 1]) unite(c, c + 1);
    if (k % v[i].first == 0) {
      c = get_root(c);
      if (sz[c] >= k / v[i].first) {
        cou = k / v[i].first;
        dfs(x, y);
        cout << "YES\n";
        for (int a = 0; a < n; a++) {
          for (int b = 0; b < m; b++) {
            if (ans[a][b])
              cout << v[i].first << " ";
            else
              cout << "0 ";
          }
          cout << "\n";
        }
        return 0;
      }
    }
  }
  cout << "NO";
}
