type sp = ^t;
     t = record
          inf : longint;
          link : sp;
         end;

const maxn = 1000;

var a : array[0..maxn, 0..maxn] of real;
    add : array[1..maxn] of pointer;
    used : array[1..maxn] of byte;
    fl, t1, t2, vl, br, i, j, k, l, o, m, n : longint;
    p1, p2 : longint;
    p, q : sp;



procedure init;
var dis : real;
    f : text;
 begin
  assign(f, 'dist.in');
  reset(f);
  readln(f, n, p1, p2);
  br := 1;
  while not(eof(f)) do
    begin
     readln(f, k, l, dis);
     a[k, l] := dis;
     a[l, k] := dis;
     new(p);
     p^.inf := l;
     p^.link := add[k];
     add[k] := p;
     new(p);
     p^.inf := k;
     p^.link := add[l];
     add[l] := p;
     if (k = p1) or (l = p1) then
       begin
        inc(br);
        used[k] := 1;
        used[l] := 1;
       end;
    end;
  close(f);
 end;


procedure outit;
 begin
  for i := 1 to n do
    writeln(a[p1, i] : 0 : 2);
 end;

function search(l, r, k : real) : real;
var rt : real;
 begin
  rt := (l + r) / 2;
  if abs(rt - k) <= 0.000001 then search := (l + r) / 2
  else if rt > k then search := search(l, rt, k)
  else search := search(rt, r, k);
 end;



procedure create(t1, t2, w : longint);
var i, j, k, l : longint;
    r, r1, r2, rr, alfa, beta, angle : real;
    raz, raz1, raz2, raz3, raz4 : real;
    sinus, cosinus : real;
    o, raztoqnie : real;
    p, q : sp;
 begin
  i := 0; j := 0; k := 0; l := 0;
  r := 0; r1 := 0; r2 := 0; rr := 0;
  raz := a[t1, t2];
  raz1 := a[p1, t1];
  raz2 := a[t1, w];
  raz3 := a[w, t2];
  raz4 := a[t2, p1];
  if (2 * raz * raz3 <> 0) then alfa := (sqr(raz) + sqr(raz3) - sqr(raz2)) / (2 * raz * raz3)
                           else alfa := 0;
  if (2 * raz * raz4 <> 0) then beta := (sqr(raz) + sqr(raz4) - sqr(raz1)) / (2 * raz * raz4)
                           else beta := 0;
  rr := alfa;
  alfa := sqrt(1 - sqr(alfa));
  alfa := alfa / rr;
  rr := beta;
  beta := sqrt(1 - sqr(beta));
  beta := beta / rr;
  alfa := arctan(alfa);
  beta := arctan(beta);
  angle := alfa + beta;
  sinus := sin(angle);
  cosinus := 1 - sqr(sinus);
  cosinus := sqrt(cosinus);
  o := pi / 2;
  if sinus < 0 then raztoqnie := sqrt((cosinus * 2 * raz4 * raz3  - sqr(raz4) - sqr(raz3)) * -1)
               else raztoqnie := sqrt((-1 * cosinus * 2 * raz4 * raz3  - sqr(raz4) - sqr(raz3)) * -1);
  a[p1, w] := raztoqnie;
  a[w, p1] := raztoqnie;
  new(p);
  p^.inf := w;
  p^.link := add[p1];
  add[p1] := p;
  new(p);
  p^.inf := p1;
  p^.link := add[w];
  add[w] := p;
 end;

procedure find;
var q : sp;
 begin
  q := add[p1];
  repeat
   p := q;
   if p = nil then break
   else if p^.link = nil then break;
  while p <> nil do
    begin
     if a[p^.inf, i] > 0 then
     begin
     if vl = 0 then
       begin
        q := p;
        vl := 1;
        t1 := p^.inf;
       end
     else
      begin
       vl := 2;
       t2 := p^.inf;
       break;
      end;
       end;
          p := p^.link;
         end;
  until a[t1, t2] > 0;
  if a[t1, t2] = 0 then vl := 0;

 end;




begin
 init;
 repeat
  i := 0;
  fl := 0;
  for i := 1 to n do
    if used[i] = 0 then
      begin
       p := add[p1];
       vl := 0;
       t1 := 0;
       t2 := 0;
       find;
       if vl = 2 then
         begin
          fl := 1;
          inc(br);
          create(t1, t2, i);
          used[i] := 1;
         end;
      end;
 until (br >= n) or (fl = 0);
 if fl = 0 then
  for p1 := 1 to n do
    repeat
    i := 0;
    fl := 0;
    for i := 1 to n do
    if used[i] = 0 then
      begin
       p := add[p1];
       vl := 0;
       t1 := 0;
       t2 := 0;
       find;
       if vl = 2 then
         begin
          fl := 1;
          inc(br);
          create(t1, t2, i);
          used[i] := 1;
         end;
      end;
 until (br >= n) or (fl = 0);
  repeat
  i := 0;
  fl := 0;
  for i := 1 to n do
    if used[i] = 0 then
      begin
       p := add[p1];
       vl := 0;
       t1 := 0;
       t2 := 0;
       find;
       if vl = 2 then
         begin
          fl := 1;
          inc(br);
          create(t1, t2, i);
          used[i] := 1;
         end;
      end;
 until (br >= n) or (fl = 0);

 outit;
end.







{begin
 writeln(57.2 * arctan(sqrt(3)));
end.

arctan}
