#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

#include <algorithm>
using namespace std;

#define PII 1.5707963267948966192313216916398

int n,m;
int X1[100],Y1[100],X2[100],Y2[100],Z[100];

int L[100],R[100];
int nl,nr;

long double xx[100],yy[100];

struct POINT
{
  int x,y;
} p[100],q[100];

int turn(POINT a,POINT b,POINT c)
{
  return a.x*(b.y-c.y)+b.x*(c.y-a.y)+c.x*(a.y-b.y);
}

int inside(long double a,long double b,long double x)
{
  if (a<b) return (a+1e-9<=x && x+1e-9<=b);
  return (b+1e-9<=x && x+1e-9<=a);
}

int badL(int i,int j)
{
  int A,B,C;
  int a,b,c;

  int d;

  long double x,y;

  A=p[L[i]].y-p[L[i-1]].y; B=p[L[i-1]].x-p[L[i]].x; C=p[L[i]].x*p[L[i-1]].y-p[L[i]].y*p[L[i-1]].x;
  a=q[R[j]].y-q[R[j-1]].y; b=q[R[j-1]].x-q[R[j]].x; c=q[R[j]].x*q[R[j-1]].y-q[R[j]].y*q[R[j-1]].x;

  d=A*b-B*a;
  if (!d) return 0;

  x=(long double)B*c-b*C;
  y=(long double)C*a-A*c;

  x/=d; y/=d;

  return (inside(q[R[j]].x,q[R[j-1]].x,x) && inside(q[R[j]].y,q[R[j-1]].y,y));
}

int badR(int i,int j)
{
  int A,B,C;
  int a,b,c;

  int d;

  long double x,y;

  A=q[R[i]].y-q[R[i-1]].y; B=q[R[i-1]].x-q[R[i]].x; C=q[R[i]].x*q[R[i-1]].y-q[R[i]].y*q[R[i-1]].x;
  a=p[L[j]].y-p[L[j-1]].y; b=p[L[j-1]].x-p[L[j]].x; c=p[L[j]].x*p[L[j-1]].y-p[L[j]].y*p[L[j-1]].x;

  if (!A) return 1;

  d=A*b-B*a;
  if (!d) return 0;

  x=(long double)B*c-b*C;
  y=(long double)C*a-A*c;

  x/=d; y/=d;

  return (inside(p[L[j]].x,p[L[j-1]].x,x) && inside(p[L[j]].y,p[L[j-1]].y,y));
}

void adj(long double &x)
{
  if (x<0 && x>=-0.0000005) x=0;
}

void partII(POINT A,POINT B)
{
  int a=B.y-A.y;
  int b=A.x-B.x; 
  int c=B.x*A.y-B.y*A.x;

  long double x=(long double)(-c)/a;

  int i;

  for(i=0; i<n; i++) xx[i]=((long double)(-Z[i]*b)-c)/a;

  long double al=PII,be=0,ga;

  for(i=0; i<n; i++)
  {
    ga=atan2(Z[i],Y1[i]);
    if (ga<al) al=ga;
    ga=atan2(Z[i],Y2[i]);
    if (ga>be) be=ga;
  }

  if (al+1e-9<be) 
  {
    puts("UNSOLVABLE");
    return;
  }

  for(i=0; i<n; i++)
    yy[i]=(long double)Z[i]/tan(al);

  puts("SOLUTION");
  adj(x);
  printf("%.6Lf\n",x);
  for(i=0; i<n; i++)
  {
    al=Z[i]; adj(xx[i]); adj(yy[i]);
    printf("%.6Lf %.6Lf %.6Lf\n",xx[i],yy[i],al);
  }
}

int main()
{
  freopen("gunman.in","r",stdin);
  freopen("gunman.out","w",stdout);

  int i,j,k;

  scanf("%d",&n);

  for(i=0; i<n; i++) scanf("%d %d %d %d %d",&X1[i],&Y1[i],&X2[i],&Y2[i],&Z[i]);

  for(i=0; i<n; i++) 
  { 
    p[i].x=X1[i]; p[i].y=Z[i];
    q[i].x=X2[i]; q[i].y=Z[i];
  }

  nl=0;
  for(i=0; i<n; i++)
  {
    while(nl>1 && turn(p[L[nl-2]],p[L[nl-1]],p[i])<=0) nl--;
    L[nl++]=i;
  }

  nr=0;
  for(i=0; i<n; i++)
  {
    while(nr>1 && turn(p[R[nr-2]],p[R[nr-1]],p[i])>=0) nr--;
    R[nr++]=i;
  }

  for(i=1; i<nl; i++)
  {
    for(j=1; j<nr; j++) if (badL(i,j)) break;
    if (j==nr) break;
  }
  if (i==nl) 
  {
    for(i=1; i<nr; i++)
    {
      for(j=1; j<nl; j++) if (badR(i,j)) break;
      if (j==nl) break;
    }
    if (i==nr) { puts("UNSOLVABLE"); return 0;}

    partII(q[R[i-1]],q[R[i]]);
  }
  else
  {
    partII(p[L[i-1]],p[L[i]]);
  }

  return 0;
}