#include <bits/stdc++.h>
using namespace std;
vector<long long> divs;
long long n, m, k;
long long b[1003][1003];
long long anss[1003][1003];
int dfs(int curl, int curc, int mark, int num) {
  int ans = 0;
  if (num and b[curl][curc] >= mark) {
    anss[curl][curc] = mark;
    ans++;
    num--;
  }
  if (num and curl > 0 and b[curl - 1][curc] >= mark and
      !anss[curl - 1][curc]) {
    int ret = dfs(curl - 1, curc, mark, num);
    ans += ret;
    num -= ret;
  }
  if (num and curc > 0 and b[curl][curc - 1] >= mark and
      !anss[curl][curc - 1]) {
    int ret = dfs(curl, curc - 1, mark, num);
    ans += ret;
    num -= ret;
  }
  if (num and curl < n - 1 and b[curl + 1][curc] >= mark and
      !anss[curl + 1][curc]) {
    int ret = dfs(curl + 1, curc, mark, num);
    ans += ret;
    num -= ret;
  }
  if (num and curc < m - 1 and b[curl][curc + 1] >= mark and
      !anss[curl][curc + 1]) {
    int ret = dfs(curl, curc + 1, mark, num);
    ans += ret;
    num -= ret;
  }
  return ans;
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> b[i][j];
    }
  }
  if (k > 1000000000000001LL) {
    cout << "NO"
         << "\n";
    return 0;
  }
  for (long long i = 1; i * i <= k; i++) {
    if (k % i == 0) {
      divs.push_back(i);
      divs.push_back(k / i);
    }
  }
  sort(divs.begin(), divs.end());
  divs.resize(unique(divs.begin(), divs.end()) - divs.begin());
  bool ok = false;
  for (int i = 0; i < divs.size(); i++) {
    if ((k / divs[i]) > n * m) {
      continue;
    }
    memset(anss, 0, sizeof anss);
    int seedl, seedc;
    for (int j = 0; j < n; j++) {
      for (int l = 0; l < m; l++) {
        if (!anss[j][l] and b[j][l] == divs[i]) {
          if (dfs(j, l, divs[i], k / divs[i]) == k / divs[i]) {
            ok = true;
            seedl = j;
            seedc = l;
            break;
          }
        }
      }
      if (ok) break;
    }
    if (ok) {
      memset(anss, 0, sizeof anss);
      dfs(seedl, seedc, divs[i], k / divs[i]);
      break;
    }
  }
  if (ok) {
    cout << "YES"
         << "\n";
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < m; j++) {
        cout << anss[i][j] << " ";
      }
      cout << "\n";
    }
  } else {
    cout << "NO"
         << "\n";
  }
  return 0;
}
