uses crt;
var n,i,j,max,min:integer;
a:array[1..100,1..100]of integer;
begin
clrscr;
write('n=');readln(n);
for i:=1 to n do
for j:=1 to n do
begin
write('a[',i,',',j,']='); readln(a[i,j]);
end;
{--------------------xuat----------------------}
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:4);
writeln;
end;
{--------------------cau-a--------------------}
max:=a[1,1];
min:=a[1,1];
for i:=1 to n do
for j:=1 to n do
begin
if max<a[i,j] then max:=a[i,j];
if min>a[i,j] then min:=a[i,j];
end;
writeln('so lon nhat la: ',max);
writeln('so nho nhat la: ',min);
{-------------------cau-b---------------------}
writeln('cac phan tu am trong ma tran la: ');
for i:=1 to n do
for j:=1 to n do
if a[i,j]<0 then write(a[i,j]:4);
writeln;
writeln('cac phan tu duong trong ma tran la: ');
for i:=1 to n do
for j:=1 to n do
if a[i,j]>0 then write(a[i,j]:4);
writeln;
writeln('cac phan tu bang 0 trong ma tran la: ');
for i:=1 to n do
for j:=1 to n do
if a[i,j]=0 then write(a[i,j]:4);
readln;
end.