#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000, MAXM = 1000;
const int DIRX[] = {-1, 0, 1, 0};
const int DIRY[] = {0, 1, 0, -1};
int n, m, a[MAXN + 9][MAXM + 9], par[MAXN * MAXM + 9], rnk[MAXN * MAXM + 9],
    cnt, ans[MAXN + 9][MAXM + 9], used[MAXN + 9][MAXM + 9];
long long k;
vector<pair<int, pair<int, int> > > v;
vector<pair<int, int> > v2;
int Hsh(int x, int y) { return (x - 1) * m + y; }
void MakeSet(int x) {
  par[x] = x;
  rnk[x] = 1;
}
int FindSet(int x) {
  if (par[x] != x) {
    par[x] = FindSet(par[x]);
  }
  return par[x];
}
void UnionSet(int x, int y) {
  x = FindSet(x);
  y = FindSet(y);
  if (x == y) {
    return;
  }
  if (rnk[x] < rnk[y]) {
    par[x] = y;
    rnk[y] += rnk[x];
  } else {
    par[y] = x;
    rnk[x] += rnk[y];
  }
}
void Dfs(int x, int y, int div) {
  cnt++;
  if (cnt > div) {
    return;
  }
  v2.push_back(make_pair(x, y));
  used[x][y] = 1;
  for (int dir = 0; dir < 4; dir++) {
    int xx = x + DIRX[dir], yy = y + DIRY[dir];
    if (xx >= 1 && xx <= n && yy >= 1 && yy <= m && a[xx][yy] >= k / div &&
        !used[xx][yy]) {
      Dfs(xx, yy, div);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      v.push_back(make_pair(a[i][j], make_pair(i, j)));
    }
  }
  sort(v.begin(), v.end());
  for (int i = 1; i <= n * m; i++) {
    MakeSet(i);
  }
  for (int div = 1; div <= n * m; div++) {
    if (k % div) {
      continue;
    }
    long long hei = k / div;
    while (!v.empty() && v.back().first >= hei) {
      int x = v.back().second.first, y = v.back().second.second;
      v.pop_back();
      for (int dir = 0; dir < 4; dir++) {
        int xx = x + DIRX[dir], yy = y + DIRY[dir];
        if (xx >= 1 && xx <= n && yy >= 1 && yy <= m && a[xx][yy] >= hei) {
          UnionSet(Hsh(x, y), Hsh(xx, yy));
        }
      }
      if (a[x][y] == hei && rnk[FindSet(Hsh(x, y))] >= div) {
        cnt = 0;
        Dfs(x, y, div);
        for (int i = 0; i < div; i++) {
          ans[v2[i].first][v2[i].second] = hei;
        }
        cout << "YES\n";
        for (int i = 1; i <= n; i++) {
          for (int j = 1; j <= m; j++) {
            cout << ans[i][j] << " ";
          }
          cout << "\n";
        }
        return 0;
      }
    }
  }
  cout << "NO\n";
  return 0;
}
