{$O+}
uses Math;

const
  nmax = 2222;
  eps = 1e-10;

type
  int = longint;
  float = extended;

  point = record
    x, y : float;
  end;

  edge = record
    a, b : int;
  end;

  line = record
    a, b, c : float;
  end;

  tar = array[1..nmax] of int;

var
  p : array[1..nmax] of point;
  name : array[1..nmax] of string;
  e : array[1..2 * nmax] of edge;
  g : array[1..nmax] of ^tar;
  deg, kl : array[1..nmax] of int;
  n : int;

  Mt : array[1..nmax] of int;

  cur : array[1..2 * nmax] of edge;
  top : int;

function rotate(var p : point) : point;
var 
  r : point;
  alpha : float;
begin
  alpha := 456963;
  r.x := p.x * cos(alpha) - p.y * sin(alpha);
  r.y := p.x * sin(alpha) + p.y * cos(alpha);
  Result := r;
end;

procedure permutate(var p : tar; n : int);
var
  i, j, t : int;
begin
  randseed := 13;
  for i := 2 to n do
  begin
    j := random(i) + 1;
    t := p[i];
    p[i] := p[j];
    p[j] := t;
  end;
end;

procedure swap(i, j : int);
var
  x : point;
  s : string;
begin
  x := p[i];
  p[i] := p[j];
  p[j] := x;
  s := name[i];
  name[i] := name[j];
  name[j] := s;
end;

procedure Sort;
var
  i, j : int;
begin
  for i := 1 to n do
    for j := i + 1 to n do
      if p[i].x > eps + p[j].x then
        swap(i, j);
end;

procedure mline(var p1, p2 : point; var l : line);
begin
  l.a := p1.y - p2.y;
  l.b := p2.x - p1.x;
  l.c := -(l.a * p1.x + l.b * p1.y);
end;

function sdist(var p : point; var l : line) : int;
begin
  Result := sign(l.a * p.x + l.b * p.y + l.c);
end;

function less(p1, p2 : point) : boolean;
begin
  Result := (p1.x + eps < p2.x) or ((Abs(p1.x - p2.x) < eps) and (p1.y +
eps < p2.y));
end;

function min(p1, p2 : point) : point;
begin
  if less(p1, p2) then Result := p1 else Result := p2;
end;

function max(p1, p2 : point) : point;
begin
  if less(p1, p2) then Result := p2 else Result := p1;
end;

function intr(var p1, p2, p3, p4 : point) : boolean;
var
  l1, l2 : line;
  d, d1, d2 : float;
  l, r : point;
begin
  Result := false;
  mline(p1, p2, l1);
  mline(p3, p4, l2);
  if (sdist(p1, l2) * sdist(p2, l2) > 0) or (sdist(p3, l1) * sdist(p4, l1)
> 0) then exit;
  d := l1.a * l2.b - l1.b * l2.a;
  d1 := -l1.c * l2.b + l1.b * l2.c;
  d2 := -l1.a * l2.c + l1.c * l2.a;
  if Abs(d) > eps then
  begin
    Result := true;
    exit;
  end;
  l := max(min(p1, p2), min(p3, p4));
  r := min(max(p1, p2), max(p3, p4));
  if less(r, l) then
    Result := false
  else
    Result := true;
end;

function ok(a, b : int) : boolean;
var
  i : int;
begin
  ok := false;
  for i := 1 to top do
    if (cur[i].a <> a) and (cur[i].a <> b) and (cur[i].b <> a) and
(cur[i].b <> b) then
      if intr(p[a], p[b], p[cur[i].a], p[cur[i].b]) then exit;
  ok := true;      
end;

function go(l, r : int; v, par : int) : boolean;
var
  i, ii : int;
  mn, sum : int;
  fl : boolean;
begin
  mn := l;
  for i := l to r do
    if p[i].y - eps > p[mn].y then mn := i;
  go := false;
  if not ok (Mt[par], mn) then exit;
  swap(l, mn);
  if par <> 0 then
  begin
    inc(top);
    cur[top].a := Mt[par];
    cur[top].b := l;
  end;
  Mt[v] := l;
    permutate(g[v]^, deg[v]);
    fl := true;
    sum := l;
    for i := 1 to deg[v] do
      if g[v][i] <> par then
      begin
        if not go(sum + 1, sum + kl[g[v][i]], g[v][i], v) then
        begin
          fl := false;
          break;
        end;
        sum := sum + kl[g[v][i]];
      end;
    if fl then go := true;
  if not Result then dec(top);
end;

procedure dfs(v, p : int);
var
  i : int;
begin
  kl[v] := 1;
  for i := 1 to deg[v] do
    if g[v][i] <> p then
    begin
      dfs(g[v][i], v);
      inc(kl[v], kl[g[v][i]]);
    end;
end;

var
  i, a, b  : int;
  ans : boolean;

begin
  reset(input, 'highways.in');
  rewrite(output, 'highways.out');
  readln(n);
  for i := 1 to n do 
  begin
    readln(name[i]);
    readln(p[i].x, p[i].y);
    p[i] := rotate(p[i]);
  end;
  fillchar(deg, sizeof(deg), 0);
  for i := 1 to n - 1 do
  begin
    read(e[i].a, e[i].b);
    inc(deg[e[i].a]);
    inc(deg[e[i].b]);
  end;
  for i := 1 to n do getmem(g[i], sizeof(int) * deg[i]);
  fillchar(deg, sizeof(deg), 0);
  for i := 1 to n - 1 do
  begin
    inc(deg[e[i].a]);
    g[e[i].a][deg[e[i].a]] := e[i].b;
    inc(deg[e[i].b]);
    g[e[i].b][deg[e[i].b]] := e[i].a;
  end;
  randseed := 13;
  for i := 1 to 10 do
  begin
    Sort;
    top := 0;
    fillchar(Mt, sizeof(Mt), 0);
    fillchar(kl, sizeof(kl), 0);
    a := random(n) + 1;
    dfs(a, 0);
    ans := go(1, n, a, 0);
    if ans then break;
  end;
  if ans then
    for i := 1 to n do writeln(name[Mt[i]])
  else writeln('No solution');
end.

