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 JAVA):

Solution:
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;

public class D {
	
	private void solve() throws IOException {
		int h = nextInt();
		int w = nextInt();
		int k = nextInt();
		
		char[][] e1 = new char[h][];
		char[][] e2 = new char[h - 1][];
		for (int i = 0; i < h - 1; i++) {
			e1[i] = nextToken().toCharArray();
			e2[i] = nextToken().toCharArray();
		}
		e1[h - 1] = nextToken().toCharArray();
		
		int all = (h - 1) * w + h * (w - 1);
		
		if (k == 1) {
			int ne = 0;
			for (char[] s: e1) {
				for (char c: s) {
					if (c == 'N') {
						ne++;
					}
				}
			}
			
			for (char[] s: e2) {
				for (char c: s) {
					if (c == 'N') {
						ne++;
					}
				}
			}
			
			if (ne * 4 > all) {
				println("NO");
			} else {
				println("YES");
				for (int i = 0; i < h; i++) {
					for (int j = 0; j < w; j++) {
						print("1 ");
					}
					println("");
				}
			}
			
			return;
		}
		
		if (h * (w - 1) < w * (h - 1)) {
			char[][] e3 = new char[w][h - 1];
			char[][] e4 = new char[w - 1][h];
			
			for (int i = 0; i < w; i++) {
				for (int j = 0; j < h - 1; j++) {
					e3[i][j] = e2[j][i];
				}
			}
			for (int i = 0; i < w - 1; i++) {
				for (int j = 0; j < h; j++) {
					e4[i][j] = e1[j][i];
				}
			}
			
			int[][] ans = fill(w, h, e3, e4);
			
			println("YES");
			for (int i = 0; i < h; i++) {
				for (int j = 0; j < w; j++) {
					print((1 + ans[j][i]) + " ");
				}
				println("");
			}
			
			return;
		}
		
		int[][] ans = fill(h, w, e1, e2);
		
		println("YES");
		for (int i = 0; i < h; i++) {
			for (int j = 0; j < w; j++) {
				print((1 + ans[i][j]) + " ");
			}
			println("");
		}
	}

	private int[][] fill(int h, int w, char[][] e1, char[][] e2) {
		int[][] ans = new int[h][w];
		fill(ans[0], e1[0]);
		for (int i = 1; i < h; i++) {
			fill(ans[i], e1[i]);
			
			int s = 0;
			for (int j = 0; j < w; j++) {
				if (!(e2[i - 1][j] == 'E' && ans[i - 1][j] == ans[i][j] ||
						e2[i - 1][j] == 'N' && ans[i - 1][j] != ans[i][j])) {
					s++;
				}
			}
			
			if (s * 2 > w) {
				for (int j = 0; j < w; j++) {
					ans[i][j] = (ans[i][j] + 1) & 1;
				}
			}
		}
		return ans;
	}
	
	private void fill(int[] a, char[] e) {
		for (int i = 1; i < a.length; i++) {
			if (e[i - 1] == 'E') {
				a[i] = a[i - 1];
			} else {
				a[i] = (a[i - 1] + 1) & 1;
			}
		}
	}
	
	private String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

	private int nextInt() throws NumberFormatException, IOException {
		return Integer.parseInt(nextToken());
	}

	private double nextDouble() throws NumberFormatException, IOException {
		return Double.parseDouble(nextToken());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private void print(Object o) {
		writer.print(o);
	}

	private void println(Object o) {
		writer.println(o);
	}

	private void printf(String format, Object... o) {
		writer.printf(format, o);
	}

	public static void main(String[] args) {
		long time = System.currentTimeMillis();
		Locale.setDefault(Locale.US);
		new D().run();
		System.err.printf("%.3f\n", 1e-3 * (System.currentTimeMillis() - time));
	}

	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	private void run() {
		try {
			reader = new BufferedReader(new InputStreamReader(System.in));
			writer = new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(13);
		}
	}
}