const
  infile = 'dist.in';
  outfile = '';

  dbg=false;
  maxn = 1000;
  maxq = 10000;
  _d = 0.00000000001;

type
  tpoint = record x, y : double; end;

  tedge = record
    p1, p2 : word;
    cp : word;
  end;

var
  f : text;

  st, en : word;

  pw, pi : word;

  n : longint;

  que    : array[1..maxq] of tedge;
  dist   : array[0..maxn, 0..maxn] of double;
  scaned : array[0..maxn] of boolean;
  coord  : array[0..maxn] of tpoint;

procedure input;
var i, p1, p2 : longint;
    d : double;
begin
  assign(f, infile);
  reset(f);
  readln(f, n, pw, pi);
  en:=1;
  que[en].p1:=pw;
  que[en].p2:=pi;
  que[en].cp:=0;
  coord[0].x:=0;
  coord[0].y:=-10;
  coord[pw].x:=0;
  coord[pw].y:=0;
  while not eof(f) do
  begin
    readln(f, p1, p2, d);
    dist[p1, p2]:=d;
    dist[p2, p1]:=d;
    if dbg then writeln('dist: ',p1, ' -> ', p2, ' = ',d:0:2);
  end;

  coord[pi].x:=dist[pw, pi];
  coord[pi].y:=0;
  scaned[pw]:=true;
  scaned[pi]:=true;
  close(f);
end;

var i, tmp : word;
  x, y, x1, y1, x2, y2 : double;
  a, b, c : double;
  aa, bb, cc, d : double;

function dst(x1, y1, x2, y2 : double) : double;
begin
  dst:=sqrt(sqr(x1-x2) + sqr(y1 - y2));
end;

function findnp(edge : tedge) : word;
begin
  tmp:=0;
  if dbg then writeln('edge: ', edge.p1, ' ', edge.p2, ' ', edge.cp);
  for i:=1 to n do
    if (dist[edge.p1, i]<>0)and(dist[edge.p2, i]<>0) then
      if not scaned[i] then
        begin
          if tmp = 0 then tmp:=i
          else if dist[edge.p1, i] < dist[edge.p1, tmp] then tmp:=i;
        end;

  if tmp = 0 then begin findnp:=1; exit; end;
  i:=tmp;

  if dbg then write(i, ' => ');

  a:=sqr(dist[edge.p1, i]) - sqr(dist[edge.p2, i]) + sqr(coord[edge.p2].x) - sqr(coord[edge.p1].x) + sqr(coord[edge.p2].y) - sqr(coord[edge.p1].y);
  b:=2*(coord[edge.p2].y - coord[edge.p1].y);
  c:=2*(coord[edge.p2].x - coord[edge.p1].x)+_d;

  aa:=sqr(b) / (sqr(c)) + 1;
  bb:=(a*b/sqr(c)) + coord[edge.p1].y - (b*coord[edge.p1].x/c);
  cc:=sqr(a)/sqr(c) - (2*a*coord[edge.p1].x/c) + sqr(coord[edge.p1].x) + sqr(coord[edge.p1].y) - sqr(dist[edge.p1, i]);

  d:=sqr(bb) - aa*cc;
  if d = 0 then y:=bb/aa
  else if d > 0 then
  begin
    y1:=(bb + sqrt(d)) / aa;
    y2:=(bb - sqrt(d)) / aa;
    if y1 > 0 then y:=y2
    else if y2 > 0 then y:=y1
    else
    begin
      x1:=(a - (b * y1)) / (c+_d);
      x2:=(a - (b * y2)) / (c+_d);
      if dst(x1, y1, coord[edge.cp].x, coord[edge.cp].y) > dst(x2, y2, coord[edge.cp].x, coord[edge.cp].y) then
        y:=y1 else y:=y2;
    end;
  end;

  x:=(a - (b * y)) / (c+_d);
  coord[i].x:=x;
  coord[i].y:=y;

  dist[pw, i]:=dst(x, y, 0, 0);
  dist[i, pw]:=dist[pw, i];

  findnp:=i;

  if dbg then writeln(i, ' -> ', pw, ' = ', dist[pw, i]);
    if dbg then writeln(x:0:2, ' ', y:0:2);
end;

procedure solve;
var k, np : word;
begin
  while st < en do
  begin
    inc(st);
    np:=findnp(que[st]);
    if not scaned[np] then
    begin
      for k:=1 to n do
        if (dist[np, k] <> 0)and(scaned[k]) then
        begin
          inc(en);
          if en > maxq then en:=1;
          que[en].p1:=k;
          que[en].p2:=np;
          if k = que[st].p1 then que[en].cp:=que[st].p2
            else que[en].cp:=que[st].p1;
          if dbg then writeln('adding: ', k, ' - ', np, ' - ', que[en].cp);
        end;
      scaned[np]:=true;
    end;
  end;
end;

procedure output;
var k : integer;
begin
  assign(f, outfile);
  rewrite(f);
  for k:=1 to n do
  writeln(f, dist[pw, k]:0:2);
  close(f);
end;

begin
  input;
  solve;
  output;
end.
