{$O-,R+,Q+}
uses Math;
const
  eps=1e-10;

type
  mustdie=record
    x1,y1,x2,y2,z:integer;
  end;

var
  i,j,n:longint;
  ad : array[1..1000] of mustdie;
  xres1, xres2, phires1, phires2, psires1, psires2 : extended;
  xres, phires, psires:extended;
  sinphires, cosphires:extended;
  t:extended;

function atan2(y,x:extended):extended;
begin
  atan2 := pi/2;
  if (abs(x) > eps) then atan2 := arctan(y/x)
  else if y < 0 then atan2 := -pi/2;
end;

procedure exit666;
begin
  writeln('UNSOLVABLE');
  halt(0);
end;

procedure check(i,j:integer);
var
  xcand1, xcand2, phicand1, phicand2, psicand1, psicand2:extended;
begin
  xcand1 := ad[i].x1 + (ad[i].x1-ad[j].x2)*ad[i].z/(ad[j].z-ad[i].z);
  xcand2 := ad[i].x2 + (ad[i].x2-ad[j].x1)*ad[i].z/(ad[j].z-ad[i].z);
  if (xcand2 - xcand1 < -eps) then exit666;
  phicand1 := atan2(ad[j].z-ad[i].z,ad[j].x2-ad[i].x1);
  phicand2 := atan2(ad[j].z-ad[i].z,ad[j].x1-ad[i].x2);
  psicand1 := atan2(ad[j].y1,ad[j].z);
  if (psicand1 < atan2(ad[i].y1,ad[i].z)) then psicand1 := atan2(ad[i].y1,ad[i].z);
  psicand2 := atan2(ad[j].y2,ad[j].z);
  if (psicand2 > atan2(ad[i].y2,ad[i].z)) then psicand2 := atan2(ad[i].y2,ad[i].z);
  if (psicand1 > psicand2) then exit666;
  if (xcand1 > xres1) then begin
    xres1 := xcand1;
    phires1 := phicand1;
  end;
  if (xcand2 < xres2) then begin
    xres2 := xcand2;
    phires2 := phicand2;
  end;
  if (psicand1 > psires1) then psires1 := psicand1;
  if (psicand2 < psires2) then psires2 := psicand2;
  if xres1-xres2 > eps then exit666;
  if psires1-psires2 > eps then exit666;
end;

begin
  assign(input,'gunman.in'); reset(input);
  assign(output,'gunman.out'); rewrite(output);
  read(n);
  xres1 := -1e100; xres2 := 1e100;
  psires1 := -pi/2; psires2 := pi/2;
  for i := 1 to n do read(ad[i].x1, ad[i].y1, ad[i].x2, ad[i].y2, ad[i].z);
  for i := 1 to n-1 do
    for j := i+1 to n do begin
      check(i,j);
    end;
  xres := xres1;
  phires := phires1;
  psires := psires1;
  sinphires := sin(phires);
  cosphires := cos(phires);
  writeln('SOLUTION');
  writeln(xres:0:6);
  for i := 1 to n do begin
    t := ad[i].z/sinphires;
    writeln(xres + cosphires*t:0:6, ' ', psires*t:0:6, ' ', ad[i].z, '.000000');
  end;
{  writeln(xres1:0:6, ' ', xres2:0:6);
  writeln(phires1:0:6, ' ', phires2:0:6);
  writeln(psires1:0:6, ' ', psires2:0:6);}
end.

