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>
void dbs(string str, T t) {
  cerr << str << " : " << t << "\n";
}
template <class T, class... S>
void dbs(string str, T t, S... s) {
  int idx = str.find(',');
  cerr << str.substr(0, idx) << " : " << t << ",";
  dbs(str.substr(idx + 1), s...);
}
template <class S, class T>
ostream& operator<<(ostream& os, const pair<S, T>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class S, class T>
ostream& operator<<(ostream& os, const map<S, T>& p) {
  os << "[ ";
  for (auto& it : p) os << it << " ";
  return os << "]";
}
template <class T>
void prc(T a, T b) {
  cerr << "[";
  for (T i = a; i != b; ++i) {
    if (i != a) cerr << ", ";
    cerr << *i;
  }
  cerr << "]\n";
}
const int H = 1010;
const int W = 1010;
int color[H + 1][W + 1];
int color1[H + 1][W + 1];
vector<string> collection;
void rotate(int h, int w) {
  string placeholder = "";
  vector<string> collection1;
  for (int i = (int)(0); i <= (int)(max(h, w)); i++) placeholder += "#";
  collection1.resize(2 * max(h, w));
  for (int i = (int)(0); i <= (int)(2 * max(h, w) - 1); i++) {
    collection1[i] = placeholder;
  }
  for (int i = (int)(0); i <= (int)(2 * h - 2); i++) {
    if (i % 2 == 0) {
      for (int j = (int)(0); j <= (int)(w - 2); j++) {
        collection1[(2 * j + 1)][i / 2] = collection[i][j];
      }
    } else {
      for (int j = (int)(0); j <= (int)(w - 1); j++) {
        assert(2 * j < int(collection1.size()));
        collection1[2 * j][i / 2] = collection[i][j];
      }
    }
  }
  collection = collection1;
}
void rotateAnswer(int h, int w) {
  for (int i = (int)(0); i <= (int)(h); i++) {
    for (int j = (int)(0); j <= (int)(w); j++) {
      color1[j][i] = color[i][j];
    }
  }
  for (int i = (int)(0); i <= (int)(w); i++) {
    for (int j = (int)(0); j <= (int)(h); j++) {
      color[i][j] = color1[i][j];
    }
  }
}
int main() {
  int h, w, k;
  cin >> h >> w >> k;
  for (int i = (int)(0); i <= (int)(2 * h - 2); i++) {
    string temp;
    cin >> temp;
    collection.push_back(temp);
  }
  if (k == 1) {
    int wrongCount = 0;
    int totalCount =
        (w - 1) * ceil((2 * h - 1) / 2) + w * floor((2 * h - 1) / 2);
    for (auto curr : collection) {
      for (int i = 0; i < int(curr.size()); i++) {
        if (curr[i] == 'N') {
          wrongCount++;
        }
      }
    }
    if (wrongCount * 4 <= totalCount) {
      cout << "YES\n";
      for (int i = (int)(0); i <= (int)(h - 1); i++) {
        for (int j = (int)(0); j <= (int)(w - 1); j++) {
          cout << "1 ";
        }
        cout << "\n";
      }
    } else {
      cout << "NO\n";
    }
    return 0;
  } else {
    cout << "YES\n";
    bool isRotated = false;
    if (h > w) rotate(h, w), isRotated = true;
    if (isRotated) swap(h, w);
    for (int i = 0; i <= 2 * h - 2; i += 2) {
      color[i / 2][0] = 1;
      for (int j = (int)(0); j <= (int)(w - 2); j++) {
        if (collection[i][j] == 'N')
          color[i / 2][j + 1] = 1 - color[i / 2][j];
        else
          color[i / 2][j + 1] = color[i / 2][j];
      }
      if (i != 0) {
        int wrongCount = 0, totalCount = int(collection[i - 1].size());
        int prevRow = (i - 2) / 2;
        for (int j = (int)(0); j <= (int)(w - 1); j++) {
          if (collection[i - 1][j] == 'N' and
              color[prevRow][j] == color[i / 2][j])
            wrongCount++;
          if (collection[i - 1][j] == 'E' and
              color[prevRow][j] != color[i / 2][j])
            wrongCount++;
        }
        if (wrongCount * 2 >= totalCount) {
          for (int j = (int)(0); j <= (int)(w - 1); j++) {
            color[i / 2][j] = 1 - color[i / 2][j];
          }
        }
      } else {
      }
    }
    if (isRotated) {
      rotateAnswer(h, w);
      swap(h, w);
    }
    for (int i = (int)(0); i <= (int)(h - 1); i++) {
      for (int j = (int)(0); j <= (int)(w - 1); j++) {
        cout << color[i][j] + 1 << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}