Problem: Even polar bears feel cold when lying on the ice. Therefore, a polar bear Alice is going to make a carpet. The carpet can be viewed as a grid with height h and width w. Then the grid is divided into h × w squares. Alice is going to assign one of k different colors to each square. The colors are numbered from 1 to k. She may choose not to use all of the colors.

However, there are some restrictions. For every two adjacent squares (squares that shares an edge) x and y, there is a color constraint in one of the forms: 

  * color(x) = color(y), or 
  * color(x) ≠ color(y). 



Example of the color constraints:

<image>

Ideally, Alice wants to satisfy all color constraints. But again, life in the Arctic is hard. It is not always possible to satisfy all color constraints. Fortunately, she will still be happy if at least <image> of the color constraints are satisfied. 

If she has 4 colors she can color the carpet in the following way:

<image>

And she is happy because <image> of the color constraints are satisfied, and <image>. Your task is to help her color the carpet.

Input

The first line contains three integers h, w, k (2 ≤ h, w ≤ 1000, 1 ≤ k ≤ w·h).

The next 2h - 1 lines describe the color constraints from top to bottom, left to right. They contain w - 1, w, w - 1, w, ..., w - 1 characters respectively. Each color constraint is represented by a character "E" or "N", where "E" means " = " and "N" means " ≠ ".

The color constraints listed in the order they are depicted on the picture.

Output

If there is a coloring that satisfies at least <image> of the color constraints, print "YES" (without quotes) in the first line. In each of the next h lines, print w integers describing the coloring.

Otherwise, print "NO" (without quotes).

Examples

Input

3 4 4
ENE
NNEE
NEE
ENEN
ENN


Output

YES
1 1 2 2
3 4 1 1
3 3 2 4

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool Up(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool Down(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
inline int getus() {
  int tmp, c;
  while (tmp = fgetc(stdin), tmp < '0' || tmp > '9')
    ;
  tmp -= '0';
  while (c = fgetc(stdin), '0' <= c && c <= '9') tmp = tmp * 10 + c - '0';
  return tmp;
}
inline int getint() {
  int tmp, c, flag;
  while (flag = fgetc(stdin), flag != '-' && (flag < '0' || flag > '9'))
    ;
  if (flag == '-')
    tmp = 0;
  else
    tmp = flag - '0';
  while (c = fgetc(stdin), '0' <= c && c <= '9') tmp = tmp * 10 + c - '0';
  return flag == '-' ? -tmp : tmp;
}
int H, W, K, tot = 0;
int ver[1025][1025], hor[1025][1025];
int G[1025][1025];
bool Solve1() {
  int res = 0;
  for (int i = (1); i <= (H); ++i) {
    G[i][1] = 0;
    for (int j = (2); j <= (W); ++j)
      G[i][j] = (hor[i][j - 1] == 'E') ? G[i][j - 1] : G[i][j - 1] ^ 1;
    if (i == 1) continue;
    int cnt = 0;
    for (int j = (1); j <= (W); ++j)
      if (ver[i - 1][j] == 'E')
        cnt += (G[i - 1][j] == G[i][j]);
      else
        cnt += (G[i - 1][j] != G[i][j]);
    if (cnt >= W - cnt) {
      res += W - cnt;
      continue;
    }
    for (int j = (1); j <= (W); ++j) G[i][j] ^= 1;
    res += cnt;
  }
  if (tot >= res * 4) {
    puts("YES");
    for (int i = (1); i <= (H); ++i)
      for (int j = (1); j <= (W); ++j)
        printf("%d%c", G[i][j] + 1, j == W ? '\n' : ' ');
    return true;
  }
  return false;
}
void Solve2() {
  int res = 0;
  for (int j = (1); j <= (W); ++j) {
    G[1][j] = 0;
    for (int i = (2); i <= (H); ++i)
      G[i][j] = (ver[i - 1][j] == 'E') ? G[i - 1][j] : G[i - 1][j] ^ 1;
    if (j == 1) continue;
    int cnt = 0;
    for (int i = (1); i <= (H); ++i)
      if (hor[i][j - 1] == 'E')
        cnt += (G[i][j - 1] == G[i][j]);
      else
        cnt += (G[i][j - 1] != G[i][j]);
    if (cnt >= H - cnt) {
      res += H - cnt;
      continue;
    }
    for (int i = (1); i <= (H); ++i) G[i][j] ^= 1;
    res += cnt;
  }
  if (tot >= res * 4) {
    puts("YES");
    for (int i = (1); i <= (H); ++i)
      for (int j = (1); j <= (W); ++j)
        printf("%d%c", G[i][j] + 1, j == W ? '\n' : ' ');
    return;
  }
  assert(0);
}
int main() {
  scanf("%d %d %d", &H, &W, &K);
  for (int i = (1); i <= (2 * H - 1); ++i) {
    if (i & 1) {
      for (int j = (1); j < (W); ++j) {
        int &c = hor[(i + 1) >> 1][j];
        do c = getchar();
        while (c != 'E' && c != 'N');
        ++tot;
      }
    } else {
      for (int j = (1); j <= (W); ++j) {
        int &c = ver[i >> 1][j];
        do c = getchar();
        while (c != 'E' && c != 'N');
        ++tot;
      }
    }
  }
  if (K == 1) {
    int mis = 0;
    for (int i = (1); i <= (H); ++i)
      for (int j = (1); j < (W); ++j)
        if (hor[i][j] == 'N') ++mis;
    for (int i = (1); i < (H); ++i)
      for (int j = (1); j <= (W); ++j)
        if (ver[i][j] == 'N') ++mis;
    if (tot >= 4 * mis) {
      puts("YES");
      for (int i = (1); i <= (H); ++i)
        for (int j = (1); j <= (W); ++j) printf("1%c", j == W ? '\n' : ' ');
    } else
      puts("NO");
    return 0;
  }
  if (!Solve1()) Solve2();
  return 0;
}