#include <bits/stdc++.h>
using namespace std;
int h, w, k;
char hor[1111][1111], ver[1111][1111];
int a[1111][1111];
int main() {
  scanf("%d%d%d", &h, &w, &k);
  for (int i = 0; i < h; ++i) {
    scanf("%s", &hor[i]);
    if (i < h - 1) scanf("%s", ver[i]);
  }
  int total = h * (w - 1) + w * (h - 1);
  if (k == 1) {
    int k = 0;
    for (int i = 0; i < h; ++i)
      for (int j = 0; j < w - 1; ++j) k += hor[i][j] == 'N';
    for (int i = 0; i < h - 1; ++i)
      for (int j = 0; j < w; ++j) k += ver[i][j] == 'N';
    if ((total - k) * 4 >= total * 3) {
      puts("YES");
      for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
          printf("%d", 1);
          putchar(j < w - 1 ? ' ' : '\n');
        }
      }
    } else {
      puts("NO");
    }
    return 0;
  }
  if (h * (w - 1) >= w * (h - 1)) {
    for (int i = 0; i < h; ++i) {
      int x = 0, cnt = 0;
      for (int j = 0; j < w; ++j) {
        a[i][j] = x;
        if (i > 0 && (a[i][j] ^ a[i - 1][j]) == (ver[i - 1][j] == 'N')) ++cnt;
        x ^= (hor[i][j] == 'N');
      }
      if (cnt * 2 < w) {
        int x = 1;
        for (int j = 0; j < w; ++j) {
          a[i][j] = x;
          x ^= (hor[i][j] == 'N');
        }
      }
    }
  } else {
    for (int j = 0; j < w; ++j) {
      int x = 0, cnt = 0;
      for (int i = 0; i < h; ++i) {
        a[i][j] = x;
        if (j > 0 && (a[i][j] ^ a[i][j - 1]) == (hor[i][j - 1] == 'N')) ++cnt;
        x ^= (ver[i][j] == 'N');
      }
      if (cnt * 2 < h) {
        int x = 1;
        for (int i = 0; i < h; ++i) {
          a[i][j] = x;
          x ^= (ver[i][j] == 'N');
        }
      }
    }
  }
  puts("YES");
  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      printf("%d", a[i][j] + 1);
      putchar(j < w - 1 ? ' ' : '\n');
    }
  }
  return 0;
}
