Please, help me.
This program passed all my tests but...
I have
Worng Answer 
((
Can anybody give me a test where my program gives WA!
Thanks!
{@BEGIN_OF_SOURCE_CODE}
{ @JUDGE_ID: 37828FF 116 Pascal}
program proga;
var i,j:integer;
m,n,t,sm,min,posit:integer;
a,b,c:array[1..10,1..100] of integer;
{ p:array[1..10] of string[100];}
res:string;
{c - s kakogo ryada priskol; b - tekushaya tsena}
function findi(i,k:integer):string;
var j,z:integer;
t:string;
cc:char;
begin
t:='';
z:=i;
for j:=k downto 1 do
begin
t:=t+chr(z);
z:=c[z,j];
end;
for j:=1 to length(t) div 2 do
begin
cc:=t[j];
t[j]:=t[length(t)-j+1];
t[length(t)-j+1]:=cc;
end;
findi:=t;
end;
begin
while not eof(input) do
begin
read(m);
read(n);
for i:=1 to m do
for j:=1 to n do
read(a[i,j]);
for i:=1 to m do
begin
b[i,1]:=a[i,1];
c[i,1]:=i;
{ p
:='';}
end;
for i:=2 to n do
for j:=1 to m do
begin
if j=1 then
begin
t:=b[m,i-1];
sm:=m;
end
else
begin
t:=b[j-1,i-1];
sm:=j-1;
end;
if t>b[j,i-1] then
begin
t:=b[j,i-1];
sm:=j;
end else
if t=b[j,i-1] then
if findi(sm,i-1)>findi(j,i-1) then sm:=j;
if j=m then
begin
if t>b[1,i-1] then
begin
t:=b[1,i-1];
sm:=1;
end else
if t=b[1,i-1] then
if findi(1,i-1)<findi(sm,i-1) then
begin
sm:=1;
t:=b[1,i-1];
end;
end
else
if t>b[j+1,i-1] then
begin
t:=b[j+1,i-1];
sm:=j+1;
end else
if t=b[j+1,i-1] then
if findi(j+1,i-1)<findi(sm,i-1) then
begin
t:=b[j+1,i-1];
sm:=j+1;
end;
b[j,i]:=a[j,i]+t;
c[j,i]:=sm;
{ p[j]:=p[sm]+chr(sm);}
end;
min:=b[1,n];
res:=findi(1,n);
{posit:=1;}
for i:=2 to m do
begin
if min>b[i,n] then
begin
min:=b[i,n];
res:=findi(i,n);
end
else
if min=b[i,n] then
if res>findi(i,n) then
res:=findi(i,n);
end;
for i:=1 to n do write(ord(res),' ');
writeln;
writeln(min);
end;
end.
{@END_OF_SOURCE_CODE}