import java.io.*;
import java.util.*;

public class glue_aa {
	public static void main(String[] args) {
		new glue_aa().run();
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	boolean eof = false;

	public void run() {
		Locale.setDefault(Locale.US);
		try {
			br = new BufferedReader(new FileReader(FNAME + ".in"));
			out = new PrintWriter(FNAME + ".out");
			solve();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			System.exit(566);
		}
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return "0";
			}
		}
		return st.nextToken();
	}

	int nextInt() {
		return Integer.parseInt(nextToken());
	}

	void myAssert(boolean u, String message) {
		if (!u) {
			throw new Error("Assertion failed!!! " + message);
		}
	}

	int inBounds(int x, int l, int r, String name) {
		myAssert(l <= x && x <= r, name + " is not in bounds: " + x
				+ " not in [" + l + ", " + r + "]");
		return x;
	}

	String FNAME = "glue";

	private void solve() throws IOException {
		int n = nextInt();
		int m = nextInt();
		int k = nextInt();
		a = new int[n][m];
		for (int i = 0; i < a.length; i++) {
			for (int j = 0; j < a[i].length; j++) {
				a[i][j] = nextInt() - 1;
			}
		}
		int[] c = new int[n * m];
		int[] cmp = new int[n * m];
		u = new boolean[n][m];
		for (int i = 0; i < u.length; i++) {
			for (int j = 0; j < u[i].length; j++) {
				if (!u[i][j]) {
					cmp[a[i][j]]++;
					dfs(i, j);
				}
				c[a[i][j]]++;
			}
		}
		for (int i = 0; i < n * m / k; i++) {
			if (c[i] != k || cmp[i] != 1) {
				out.println("Wrong answer");
				return;
			}
		}
		out.println("OK");
	}

	int[] dx = new int[] { 0, 1, 0, -1 };
	int[] dy = new int[] { 1, 0, -1, 0 };

	private void dfs(int x, int y) {
		u[x][y] = true;
		for (int i = 0; i < dx.length; i++) {
			int nx = x + dx[i];
			int ny = y + dy[i];
			if (0 <= nx && nx < a.length && 0 <= ny && ny < a[nx].length
					&& a[nx][ny] == a[x][y] && !u[nx][ny]) {
				dfs(nx, ny);
			}
		}
	}

	int[][] a;
	boolean[][] u;

}
