1.

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Dennis / Felix
*/
public class HomogeneousSquares {

public static void main(String... args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));
int n, i;
int[][] matrix;
StringTokenizer st;
boolean result;

while (true) {

n = Integer.parseInt(br.readLine());

if (n == 0) {
out.flush();
break;
}

matrix = new int[n][n];

for (i = 0; i < n; i++) {
st = new StringTokenizer(br.readLine());
for (int k = 0; k < n; k++)
matrix[i][k] = Integer.parseInt(st.nextToken());

}

result = true;
for (i = 0; i < n - 1; i++) {
for (int k = 0; k < n - 1; k++)
if (matrix[i][k] + matrix[i + 1][k + 1] != matrix[i][k + 1] + matrix[i + 1][k]) {
result = false;
break;
}

if (!result)
break;
}

out.println(result ? "homogeneous" : "not homogeneous");
}
}
}