#include <bits/stdc++.h>
using namespace std;
int cols[1000][1000];
int rows[1000][1000];
int ans[1000][1000];
int main() {
  int h, w, k;
  cin >> h >> w >> k;
  int count = 0;
  int countOfUnequals = 0;
  for (int i = 0; i < 2 * h - 1; i++) {
    if (i % 2 == 0) {
      string s;
      cin >> s;
      for (int j = 0; j < w - 1; j++) {
        rows[i / 2][j] = s[j] == 'E' ? 0 : 1;
        count++;
        if (s[j] == 'N') {
          countOfUnequals++;
        }
      }
    } else {
      string s;
      cin >> s;
      for (int j = 0; j < w; j++) {
        cols[j][i / 2] = s[j] == 'E' ? 0 : 1;
        count++;
        if (s[j] == 'N') {
          countOfUnequals++;
        }
      }
    }
  }
  if (k == 1) {
    if (4 * (count - countOfUnequals) < 3 * count) {
      cout << "NO" << endl;
      return 0;
    }
    cout << "YES" << endl;
    for (int i = 0; i < h; i++) {
      for (int j = 0; j < w; j++) {
        printf("1 ");
      }
      printf("\n");
    }
    return 0;
  }
  if (h > w) {
    for (int i = 0; i < w; i++) {
      ans[0][i] = 0;
      for (int j = 1; j < h; j++) {
        ans[j][i] = (ans[j - 1][i] + cols[i][j - 1]) % 2;
      }
      if (i == 0) {
        continue;
      }
      int errorsCount = 0;
      for (int j = 0; j < h; j++) {
        int test = (ans[j][i - 1] + rows[j][i - 1]) % 2;
        if (test != ans[j][i]) {
          errorsCount++;
        }
      }
      if (errorsCount > h / 2) {
        for (int j = 0; j < h; j++) {
          ans[j][i] = (ans[j][i] + 1) % 2;
        }
      }
    }
  } else {
    for (int i = 0; i < h; i++) {
      ans[i][0] = 0;
      for (int j = 1; j < w; j++) {
        ans[i][j] = (ans[i][j - 1] + rows[i][j - 1]) % 2;
      }
      if (i == 0) {
        continue;
      }
      int errorsCount = 0;
      for (int j = 0; j < w; j++) {
        int test = (ans[i - 1][j] + cols[j][i - 1]) % 2;
        if (test != ans[i][j]) {
          errorsCount++;
        }
      }
      if (errorsCount > w / 2) {
        for (int j = 0; j < w; j++) {
          ans[i][j] = (ans[i][j] + 1) % 2;
        }
      }
    }
  }
  cout << "YES" << endl;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      printf("%d ", ans[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}
