Under construction

Still being built. Things may change

Glue!

Interview

Time limit2sMemory limit1024 MB

Summary
Given a grid of piece labels, check that every label covers exactly k cells and that each piece is connected through shared sides.
Level

Medium4 of 10

Topics
BFS, Hash map, Matrix
Solved
No attempts yet

Problem

In the basic-level problem "Cut!" of a previous online olympiad, contestants had to cut a sheet of graph paper. The sheet could only be cut along the grid lines, and each resulting piece had to consist of exactly kk cells of the original sheet.

In this problem, you solve the jury's task: determine whether the team cut the sheet correctly.

Input

The first line contains two integers nn and mm (1≤n,m≤1001 \le n, m \le 100), the height and width of the sheet in cells. The second line contains kk (1≤k≤10001 \le k \le 1000). It is guaranteed that n⋅mn \cdot m is divisible by kk.

Each of the next nn lines contains mm integers. Each integer is the number of the piece that the team assigned to that cell. Pieces are numbered with positive integers starting from 1.

Output

If the team cut the sheet correctly, print OK. Otherwise, print Wrong answer.

Examples3

  1. Example 1

    Input
    4 3
    6
    1 1 2
    1 2 2
    1 2 2
    1 1 2
    
    Expected output
    OK
    
  2. Example 2

    Input
    2 2
    1
    1 1
    2 3
    
    Expected output
    Wrong answer
    
  3. Example 3

    Input
    2 2
    2
    1 2
    2 1
    
    Expected output
    Wrong answer