/**
#include<stdio.h>
int main()
{
int i,j,k,n,m,a,b, q, sum = 0;
int arr[101][101]={};
scanf("%d", &n);
for (i = 1 ; i <= n ; i ++)
{
scanf("%d %d", &a, &b);
for (q = b ; q < (b + 10) ; q ++)
for (j = a ; j < (a + 10) ; j ++)
arr[q][j] = 1;
}
for (i = 1 ; i <= 100 ; i ++)
for (j = 1 ; j <= 100 ; j ++)
sum +=arr[i][j];
printf("%d", sum);
return 0;
}
#include<stdio.h>
int main()
{
int i,j,k,n,m, x1, y1, x2, y2, sum = 0;
int arr[101][101] = {};
for (i = 1; i <= 4 ; i ++)
{
scanf("%d %d %d %d", &x1,&y1,&x2,&y2);
for (k = y1 ; k < y2 ; k ++)
{
for (j = x1 ; j < x2 ; j ++)
{
arr[k][j] = 1;
}
}
}
for (i = 0 ; i < 100 ; i ++)
for (j = 0 ; j < 100 ; j ++)
sum += arr[i][j];
printf("%d", sum);
return 0;
}
#include<stdio.h>
int map[101][101] = {}, n, m, k, sum = 0, memo[101] = {};
void dfs(int i, int j)
{
if (i < 0 || i >= n || j < 0 || j >= m || map[i][j] == 1)
{
return ;
}
map[i][j] = 1;
sum ++;
dfs(i - 1, j);
dfs(i, j + 1);
dfs(i + 1, j);
dfs(i, j - 1);
}
int main()
{
int i, j, x1, x2, y1, y2, q, cnt = 0, t;
scanf("%d %d %d", &m,&n,&k);
for (q = 1 ; q <= k ; q ++)
{
scanf("%d %d %d %d", &x1,&y1,&x2,&y2);
for (i = x1 ; i < x2 ; i ++)
{
for (j = y1 ; j < y2 ; j ++)
{
map[i][j] = 1;
}
}
}
for (i = 0 ; i < n ; i ++)
{
for (j = 0 ; j < m ; j ++)
{
if (map[i][j] == 0)
{
sum = 0;
cnt ++;
dfs(i, j);
// printf("i : %d j : %d\n", i, j);
memo[cnt] = sum;
}
}
}
for (i = 1 ; i < cnt ; i ++)
{
for (j = 1 ; j <= cnt - i ; j ++)
{
if (memo[j] > memo[j + 1])
{
t = memo[j];
memo[j] = memo[j + 1];
memo[j + 1] = t;
}
}
}
printf("%d\n", cnt);
for (i = 1 ; i <= cnt ; i ++)
{
printf("%d ", memo[i]);
}
return 0;
}
#include<stdio.h>
int map[101][101] = {},n,m, map1[101][101] = {};
void dfs(int i, int j, int num)
{
if (i < 1 || i > n || j < 1 || j > m || map1[i][j] != num)
{
return ;
}
if (num == 1)
{
map1[i][j] = 0;
}
else
{
map1[i][j] = 1;
}
dfs(i - 1, j, num);
dfs(i, j + 1, num);
dfs(i + 1, j, num);
dfs(i, j - 1, num);
}
int main()
{
int i, j, k, cnt = 0, cnt1 = 0;
scanf("%d %d", &n, &m);
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= m ; j ++)
{
scanf("%d", &map[i][j]);
map1[i][j] = map[i][j];
}
}
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= m ; j ++)
{
if (map1[i][j] == 0)
{
cnt ++;
dfs(i, j, 0);
}
}
}
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= m ; j ++)
{
map1[i][j] = map[i][j];
}
}
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= m ; j ++)
{
if (map1[i][j] == 1)
{
cnt1 ++;
dfs(i, j, 1);
}
}
}
printf("%d %d", cnt, cnt1);
return 0;
}
**/
#include<stdio.h>
int map[101][101] = {};
int main()
{
int i,j,k,n,m, max = 0, q;
scanf("%d", &n);
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= n ; j ++)
{
scanf("%d", &map[i][j]);
if (map[i][j] > max)
{
max = map[i][j];
}
}
}
for (q = 1 ; q <= max ; q ++)
{
for (i = 1 ; i <= n ; i ++)
{
for (j = 1 ; j <= n ; j ++)
{
}
}
}
}