#include <bits/stdc++.h>
using namespace std;
int v[1010][1010], v1[1010][1010], tip[100], n, m;
char sir[2010][1010], sir1[2010][1010];
void transpune() {
  for (int i = 1; i < 2 * m; i++)
    if (i % 2)
      for (int j = 1; j < n; j++) sir1[i][j] = sir[2 * j][i / 2 + 1];
    else
      for (int j = 1; j <= n; j++) sir1[i][j] = sir[2 * j - 1][i / 2];
  swap(n, m);
  for (int i = 1; i < 2 * n; i++)
    for (int j = 1; j <= m - i % 2; j++) sir[i][j] = sir1[i][j];
}
int solve1() {
  int sol = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      if (j < m) sol += sir[2 * i - 1][j] == 'E';
      if (i < n) sol += sir[2 * i][j] == 'E';
    }
  return 4 * sol >= 3 * (2 * n * m - n - m);
}
int solve2() {
  int transpus = 0;
  if (n > m) {
    transpune();
    transpus = 1;
  }
  for (int i = 1; i <= n; i++) {
    v[i][1] = 0;
    for (int j = 2; j <= m; j++)
      v[i][j] = v[i][j - 1] ^ tip[sir[2 * i - 1][j - 1]];
    if (i > 1) {
      int nr = 0;
      for (int j = 1; j <= m; j++)
        nr += (v[i][j] == v[i - 1][j]) ^ tip[sir[2 * i - 2][j]];
      if (2 * nr < m)
        for (int j = 1; j <= m; j++) v[i][j] ^= 1;
    }
  }
  if (transpus) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) v1[j][i] = v[i][j];
    swap(n, m);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++) v[i][j] = v1[i][j];
  }
  return 1;
}
int main() {
  int k, ok;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i < 2 * n; i++) scanf("\n%s", sir[i] + 1);
  tip['E'] = 0;
  tip['N'] = 1;
  if (k == 1)
    ok = solve1();
  else
    ok = solve2();
  if (ok) {
    printf("YES\n");
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= m; j++) printf("%d ", v[i][j] + 1);
      printf("\n");
    }
  } else
    printf("NO");
  return 0;
}
