#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;
}
