const INP = 'input.txt';
var
f : text;
n, i, j, a, b, sum : integer;
len, s, p : array[1..1000] of integer;
G : array[1..100,1..100] of integer;
BEGIN
{doc du lieu tu tep}
assign(f, INP);
reset(f);
readln(f, n, a, b);
writeln(n, ' ', a, ' ', b);
sum :=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
read(f, G[i, j]);
sum := sum + G[i, j];
end;
readln(f);
end;
{dat vo cung cho tat ca cap dinh khong co duong di}
for i:=1 to n do
for j:=1 to n do
if (i <> j) and (G[i, j] = 0) then
G[i, j] := sum;
for i:=1 to n do
begin
len[i] := sum; {khoi tao do dai tu a toi moi dinh la vo cung}
s[i] := 0; {danh sach cac diem da xet}
p[i] := a; {diem bat dau cua moi dinh la a}
end; {do dai tu a den a la 0}
len[a] := 0;
while (s[b] = 0) do {trong khi dinh b chua duoc duyet}
begin
for i:=1 to n do {tim 1 dinh chua xet ma co the di tu a den no}
begin
if (s[i]=0) and (len[i] < sum) then
begin
break;
end;
end;
if i>n then {khong tim thay dinh nao, dung lai}
begin
break;
end;
for j:=1 to n do {tim dinh ma duong di tu a den no la nho nhat}
if (s[j] = 0) and (len[i] > len[j]) then i := j;
s[i] := 1; {danh dau da duyet}
for j:=0 to n do {tinh lai duong di den cac dinh chua xet}
if (s[j] = 0) and (len[i] + G[i, j] < len[j]) then
begin
len[j] := len[i] + G[i, j];
p[j] := i;
end;
end;
i := b;
while(i <>a) do
begin
write(i, ' <-- ');
i := p[i];
end;
writeln(a);
END.
Y29uc3QgSU5QID0gJ2lucHV0LnR4dCc7CnZhcgogICAgICAgIGYgOiB0ZXh0OwogICAgICAgIG4sIGksIGosIGEsIGIsIHN1bSA6IGludGVnZXI7CiAgICAgICAgbGVuLCBzLCBwIDogYXJyYXlbMS4uMTAwMF0gb2YgaW50ZWdlcjsKICAgICAgICBHIDogYXJyYXlbMS4uMTAwLDEuLjEwMF0gb2YgaW50ZWdlcjsKQkVHSU4KCiAgICAgICAge2RvYyBkdSBsaWV1IHR1IHRlcH0KICAgICAgICBhc3NpZ24oZiwgSU5QKTsKICAgICAgICByZXNldChmKTsKCiAgICAgICAgcmVhZGxuKGYsIG4sIGEsIGIpOwogICAgICAgIHdyaXRlbG4obiwgJyAnLCBhLCAnICcsIGIpOwogICAgICAgIHN1bSA6PTA7CiAgICAgICAgZm9yIGk6PTEgdG8gbiBkbwogICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICBmb3Igajo9MSB0byBuIGRvCiAgICAgICAgICAgICAgICBiZWdpbgogICAgICAgICAgICAgICAgICAgICAgICByZWFkKGYsIEdbaSwgal0pOwogICAgICAgICAgICAgICAgICAgICAgICBzdW0gOj0gc3VtICsgR1tpLCBqXTsKICAgICAgICAgICAgICAgIGVuZDsKICAgICAgICAgICAgICAgIHJlYWRsbihmKTsKICAgICAgICBlbmQ7CgogICAgICAgIHtkYXQgdm8gY3VuZyBjaG8gdGF0IGNhIGNhcCBkaW5oIGtob25nIGNvIGR1b25nIGRpfQogICAgICAgIGZvciBpOj0xIHRvIG4gZG8KICAgICAgICAgICAgICAgIGZvciBqOj0xIHRvIG4gZG8KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGkgPD4gaikgYW5kIChHW2ksIGpdID0gMCkgdGhlbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIEdbaSwgal0gOj0gc3VtOwoKICAgICAgICBmb3IgaTo9MSB0byBuIGRvCiAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgIGxlbltpXSA6PSBzdW07IHtraG9pIHRhbyBkbyBkYWkgdHUgYSB0b2kgbW9pIGRpbmggbGEgdm8gY3VuZ30KICAgICAgICAgICAgICAgIHNbaV0gOj0gMDsgICAgIHtkYW5oIHNhY2ggY2FjIGRpZW0gZGEgeGV0fQogICAgICAgICAgICAgICAgcFtpXSA6PSBhOyAgICAge2RpZW0gYmF0IGRhdSBjdWEgbW9pIGRpbmggbGEgYX0KICAgICAgICBlbmQ7ICAgICAgICAgICAgICAgICAgIHtkbyBkYWkgdHUgYSBkZW4gYSBsYSAwfQogICAgICAgIGxlblthXSA6PSAwOwoKICAgICAgICB3aGlsZSAoc1tiXSA9IDApIGRvICAgICB7dHJvbmcga2hpIGRpbmggYiBjaHVhIGR1b2MgZHV5ZXR9CiAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgIGZvciBpOj0xIHRvIG4gZG8gICAge3RpbSAxIGRpbmggY2h1YSB4ZXQgbWEgY28gdGhlIGRpIHR1IGEgZGVuIG5vfQogICAgICAgICAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHNbaV09MCkgYW5kIChsZW5baV0gPCBzdW0pIHRoZW4KICAgICAgICAgICAgICAgICAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBicmVhazsKICAgICAgICAgICAgICAgICAgICAgICAgZW5kOwogICAgICAgICAgICAgICAgZW5kOwogICAgICAgICAgICAgICAgaWYgaT5uIHRoZW4gICAgICB7a2hvbmcgdGltIHRoYXkgZGluaCBuYW8sIGR1bmcgbGFpfQogICAgICAgICAgICAgICAgYmVnaW4KICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7CiAgICAgICAgICAgICAgICBlbmQ7CgogICAgICAgICAgICAgICAgZm9yIGo6PTEgdG8gbiBkbyAgICAge3RpbSBkaW5oIG1hIGR1b25nIGRpIHR1IGEgZGVuIG5vIGxhIG5obyBuaGF0fQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoc1tqXSA9IDApIGFuZCAobGVuW2ldID4gbGVuW2pdKSB0aGVuIGkgOj0gajsKCiAgICAgICAgICAgICAgICBzW2ldIDo9IDE7ICAgICAgICAgICAge2RhbmggZGF1IGRhIGR1eWV0fQoKICAgICAgICAgICAgICAgIGZvciBqOj0wIHRvIG4gZG8gICAgICB7dGluaCBsYWkgZHVvbmcgZGkgZGVuIGNhYyBkaW5oIGNodWEgeGV0fQogICAgICAgICAgICAgICAgICAgICAgICBpZiAoc1tqXSA9IDApIGFuZCAobGVuW2ldICsgR1tpLCBqXSA8IGxlbltqXSkgdGhlbgogICAgICAgICAgICAgICAgICAgICAgICBiZWdpbgogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGxlbltqXSA6PSBsZW5baV0gKyBHW2ksIGpdOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHBbal0gOj0gaTsKICAgICAgICAgICAgICAgICAgICAgICAgZW5kOwogICAgICAgIGVuZDsKCiAgICAgICAgaSA6PSBiOwogICAgICAgIHdoaWxlKGkgPD5hKSBkbwogICAgICAgIGJlZ2luCiAgICAgICAgICAgICAgICB3cml0ZShpLCAnIDwtLSAnKTsKICAgICAgICAgICAgICAgIGkgOj0gcFtpXTsKICAgICAgICBlbmQ7CiAgICAgICAgd3JpdGVsbihhKTsKRU5ELg==