#include <bits/stdc++.h>
using namespace std;
struct Node {
  int pi, Rank, sze;
} DSU[1001 * 1001];
int A[1001][1001];
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};
multiset<int> S;
vector<pair<int, pair<int, int> > > V;
long long K;
int save;
int N, M;
bool inrange(int x, int y) { return x < N && x >= 0 && y >= 0 && y < M; }
int Find(int i) {
  if (DSU[i].pi != i) return DSU[i].pi = Find(DSU[i].pi);
  return i;
}
void Union(int x, int y) {
  S.erase(S.lower_bound(DSU[x].sze));
  S.erase(S.lower_bound(DSU[y].sze));
  S.insert(DSU[x].sze + DSU[y].sze);
  if (DSU[x].Rank > DSU[y].Rank) {
    DSU[y].pi = x;
    DSU[x].sze += DSU[y].sze;
  } else {
    DSU[x].pi = y;
    DSU[y].sze += DSU[x].sze;
    if (DSU[x].Rank == DSU[y].Rank) ++DSU[y].Rank;
  }
}
int vis[1001][1001];
long long sum = 0;
void dfs(int x, int y) {
  if (sum > 0) {
    vis[x][y] = 1;
    --sum;
  } else if (sum == 0) {
    vis[x][y] = 2;
  }
  for (int i = 0; i < 4; ++i)
    if (inrange(x + dx[i], y + dy[i]) && A[x + dx[i]][y + dy[i]] >= save &&
        !vis[x + dx[i]][y + dy[i]])
      dfs(x + dx[i], y + dy[i]);
}
int main() {
  int i, j;
  cin >> N >> M >> K;
  for (i = 0; i < N; ++i)
    for (j = 0; j < M; ++j) {
      cin >> A[i][j];
      V.push_back({A[i][j], {i, j}});
    }
  for (i = 0; i < N * M; ++i) {
    DSU[i].pi = i;
    DSU[i].Rank = 0;
    DSU[i].sze = 1;
    S.insert(1);
  }
  sort(V.begin(), V.end());
  for (i = V.size() - 1; i >= 0; --i) {
    for (j = 0; j < 4; ++j)
      if (inrange(V[i].second.first + dx[j], V[i].second.second + dy[j])) {
        if (Find(V[i].second.first * M + V[i].second.second) !=
                Find((V[i].second.first + dx[j]) * M + V[i].second.second +
                     dy[j]) &&
            A[V[i].second.first][V[i].second.second] <=
                A[V[i].second.first + dx[j]][V[i].second.second + dy[j]])
          Union(Find(V[i].second.first * M + V[i].second.second),
                Find((V[i].second.first + dx[j]) * M + V[i].second.second +
                     dy[j]));
      }
    if (K % V[i].first == 0 && *S.rbegin() >= K / V[i].first) break;
  }
  if (i == -1) {
    cout << "NO";
    return 0;
  } else {
    cout << "YES\n";
    save = V[i].first;
    pair<int, int> xx = V[i].second;
    sum = K / V[i].first;
    dfs(xx.first, xx.second);
    for (i = 0; i < N; ++i, cout << '\n')
      for (j = 0; j < M; ++j) cout << (vis[i][j] == 1 ? save : 0) << " ";
  }
  return 0;
}
