{$APPTYPE CONSOLE}


const
    _fin='gunman.in';
    _fout='gunman.out';
    MAXW=100;
    EPS=1E-7;


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

var
    wnd:array[1..MAXW] of TWin;
    xx,yy:array[1..MAXW*2] of longint;
    zz:array[1..MAXW] of longint;
    cc,i,n:longint;
    poss:boolean;

procedure order;
var t,i,j:longint;
begin
    for i:=1 to cc-1 do
        for j:=i+1 to cc do
            if xx[i]>xx[j] then
            begin
                t:=xx[i];xx[i]:=xx[j];xx[j]:=t;
            end;
    for i:=1 to cc-1 do
        for j:=i+1 to cc do
            if yy[i]>yy[j] then
            begin
                t:=yy[i];yy[i]:=yy[j];yy[j]:=t;
            end;
    for i:=1 to n-1 do
        for j:=i+1 to n do
            if zz[i]>zz[j] then
            begin
                t:=zz[i];zz[i]:=zz[j];zz[j]:=t;
            end;
end;

procedure process;
label
 l1,l2;

var i,j,k,l:longint;
    tz,ys,zs,x,y,ah,bh,ch,av,bv,cv,xs,xt,yt,zt,d,a,b,c:double;
    t2,t1,tt:boolean;
begin
    order;
    t1:=false;
    t2:=false;
    for i:=1 to cc do
        for j:=1 to n do
            for k:=1 to n do
            begin
                tt:=true;
                a:=zz[k]-zz[j];
                if a=0 then continue;
                b:=xx[1]-xx[i];
                c:=-a*xx[1]-b*zz[j];
                for l:=1 to n do
                begin
                    d:=(-b*wnd[l].z-c)/a;
                    if (d>wnd[l].x2)or(d<wnd[l].x1) then begin
                        tt:=false;
                        break;
                    end;
                end;
                if tt then begin
                    t1:=true;
                    xs:=-c/a;
                    xt:=xx[1];
                    zt:=zz[j];
                    goto l1;
                end;
            end;
l1:
    if not t1 then
    begin
        poss:=false;
        exit;
    end;
    for i:=1 to cc do
        for j:=1 to n do
    begin
        a:=zz[j];
        if a=0 then continue;
        b:=-yy[i];
        c:=0;
        tt:=true;
        for l:=1 to n do
        begin
            d:=(-b*wnd[l].z)/a;

            if (d<wnd[l].y1)or(d>wnd[l].y2)  then begin
                tt:=false;
                break;
            end;
        end;
        if tt then begin
            yt:=(-b*zt-c)/a;
            t2:=true;
            goto l2;
        end;
    end;
l2:
    if not t2 then begin
        poss:=false;
        exit;
    end;
    zs:=0;
    ys:=0;
    writeln('SOLUTION');
    writeln(xs:0:6);

    ah:=zt-zs;
    bh:=xs-xt;
    ch:=-xt*ah-zt*bh;

    av:=zs-zt;
    bv:=yt-ys;
    cv:=-av*yt-bv*zt;
    
    for i:=1 to n do
    begin
        x:=(-bh*wnd[i].z-ch)/ah;
        y:=(-bv*wnd[i].z-cv)/av;
	tz:=wnd[i].z;
        if abs(x)<EPS then x:=0;
        if abs(y)<EPS then y:=0;
        writeln(x:0:6,' ',y:0:6,' ',tz:0:6);
    end;
    poss:=true;
end;

begin
    assign(input,_fin);reset(input);
    read(n);
    for i:=1 to n do
        begin
            read(wnd[i].x1,wnd[i].y1,wnd[i].x2,wnd[i].y2,wnd[i].z);
            inc(cc);
            xx[cc]:=wnd[i].x1;
            yy[cc]:=wnd[i].y1;
            inc(cc);
            xx[cc]:=wnd[i].x2;
            yy[cc]:=wnd[i].y2;
            zz[i]:=wnd[i].z;
        end;
    close(input);
    assign(output,_fout);rewrite(output);
    process;
    if not poss then writeln('UNSOLVABLE');

    close(output);
end.