#include <bits/stdc++.h>
using namespace std;
int n, m, k;
char s[2010][1010];
int a[1010][1010];
int main() {
  scanf("%d%d%d\n", &n, &m, &k);
  if (k == 1) {
    int cnt = 0;
    int tot = 0;
    for (int i = 0; i < 2 * n - 1; ++i) {
      gets(s[0]);
      for (int j = 0; j < m - ((i + 1) & 1); ++j, ++tot)
        if (s[0][j] == 'E') cnt++;
    }
    if (cnt * 4 >= tot * 3) {
      puts("YES");
      for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
          if (j != 0) printf(" ");
          printf("1");
        }
        printf("\n");
      }
    } else
      puts("NO");
    return 0;
  }
  puts("YES");
  for (int i = 0; i < 2 * n - 1; ++i) gets(s[i]);
  if (n < m) {
    for (int i = 0; i < n; ++i) {
      int ii = 2 * i;
      a[i][0] = 0;
      for (int j = 1; j < m; ++j)
        if (s[ii][j - 1] == 'E')
          a[i][j] = a[i][j - 1];
        else
          a[i][j] = 1 - a[i][j - 1];
    }
    for (int i = 1; i < n; ++i) {
      int cnt = 0;
      for (int j = 0; j < m; ++j)
        if (s[2 * i - 1][j] == 'E')
          cnt += a[i][j] == a[i - 1][j];
        else
          cnt += a[i][j] != a[i - 1][j];
      if (cnt < m - cnt)
        for (int j = 0; j < m; ++j) a[i][j] = 1 - a[i][j];
    }
  } else {
    for (int i = 0; i < m; ++i) {
      a[0][i] = 0;
      for (int j = 1; j < n; ++j)
        if (s[2 * j - 1][i] == 'E')
          a[j][i] = a[j - 1][i];
        else
          a[j][i] = 1 - a[j - 1][i];
    }
    for (int i = 1; i < m; ++i) {
      int cnt = 0;
      for (int j = 0; j < n; ++j)
        if (s[2 * j][i - 1] == 'E')
          cnt += a[j][i] == a[j][i - 1];
        else
          cnt += a[j][i] != a[j][i - 1];
      if (cnt < n - cnt)
        for (int j = 0; j < n; ++j) a[j][i] = 1 - a[j][i];
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (j != 0) printf(" ");
      printf("%d", a[i][j] + 1);
    }
    printf("\n");
  }
}
