#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  vector<string> v(2 * n - 1);
  for (auto& x : v) {
    cin >> x;
  }
  if (k == 1) {
    const int nr = accumulate(begin(v), end(v), 0,
                              [](const int x, const string&str) {
                                return x + count(begin(str), end(str), 'E');
                              }),
              total = accumulate(
                  begin(v), end(v), 0,
                  [](const int x, const string&str) { return x + str.size(); });
    if (4 * nr >= 3 * total) {
      cout << "YES\n";
      string cur_line(2 * m, ' ');
      cur_line.back() = '\n';
      for (int j = 0; j < m; ++j) {
        cur_line[2 * j] = '1';
      }
      for (int i = 0; i < n; ++i) {
        cout << cur_line;
      }
    } else {
      cout << "NO\n";
    }
    return 0;
  }
  vector<vector<int>> rez(n, vector<int>(m, 0));
  if (n <= m) {
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m - 1; ++j) {
        rez[i][j + 1] = (rez[i][j] ^ (v[2 * i][j] == 'N'));
      }
    }
    for (int i = 0; i < n - 1; ++i) {
      int wrong = 0;
      for (int j = 0; j < m; ++j) {
        wrong += ((v[2 * i + 1][j] == 'E') != (rez[i][j] == rez[i + 1][j]));
      }
      if (2 * wrong > m) {
        for (int j = 0; j < m; ++j) {
          rez[i + 1][j] ^= 1;
        }
      }
    }
  } else {
    for (int i = 0; i < n - 1; ++i) {
      for (int j = 0; j < m; ++j) {
        rez[i + 1][j] = (rez[i][j] ^ (v[2 * i + 1][j] == 'N'));
      }
    }
    for (int j = 0; j < m - 1; ++j) {
      int wrong = 0;
      for (int i = 0; i < n; ++i) {
        wrong += ((v[2 * i][j] == 'E') != (rez[i][j] == rez[i][j + 1]));
      }
      if (2 * wrong > n) {
        for (int i = 0; i < n; ++i) {
          rez[i][j + 1] ^= 1;
        }
      }
    }
  }
  string cur_line(2 * m, ' ');
  cur_line.back() = '\n';
  cout << "YES\n";
  for (const auto x : rez) {
    for (int i = 0; i < m; ++i) {
      cur_line[2 * i] = x[i] + '1';
    }
    cout << cur_line;
  }
  return 0;
}
