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

using namespace std;

FILE* in=fopen("gunman.in","r");
//FILE* in=stdin;
FILE* out=fopen("gunman.out","w");
//FILE* out=stdout;

const long N = 105;

double Eps = 1e-9;//????
struct point 
{
	double x,y,z;
};

point p[N],f[N],s[N];

long n;
double ky,c;

bool proverY()
{
	double min,max;
	min=0;
	max=1e10;
	long i;
	for(i=0;i<n;++i) {
		if (min<s[i].y/s[i].z)
			min=s[i].y/s[i].z;
		if (max>f[i].y/f[i].z)
			max=f[i].y/f[i].z;
	}
	if (min>max+Eps)
		return false;
	ky=min;
	return true;
}

bool prover(point a, point b)
{
	long i;
	double al=(a.x-b.x)/(a.z-b.z),x;
	double bt=a.x-al*a.z;
	for(i=0;i<n;i++)
	{
		x=s[i].z*al+bt;
		if (s[i].x-Eps<x && f[i].x+Eps>x)
		{
			p[i].x=x;
			p[i].z=s[i].z;
		}
		else
			return false;
	}
	c=bt;
	return true;
}

bool look()
{
	long i,j;
	for(i=0;i<n;++i)
		for(j=i+1;j<n;++j)
		{
			if (prover(s[i],f[j]))
				return true;
			if (prover(f[i],f[j]))
				return true;
			if (prover(s[i],s[j]))
				return true;
			if (prover(f[i],s[j]))
				return true;
		}
	return false;
}

int main()
{
	long i;
	fscanf(in,"%ld",&n);
	for(i=0;i<n;++i) {
		fscanf(in,"%lf%lf%lf%lf%lf",&s[i].x,&s[i].y,&s[i].z,&f[i].x,&f[i].y);
		f[i].z=s[i].z;
	}
	if (!proverY())
	{
		fprintf(out,"UNSOLVABLE\n");
		return 0;
	}

	if (!look())
	{
		fprintf(out,"UNSOLVABLE\n");
		return 0;
	}

	for(i=0;i<n;++i)
		p[i].y=s[i].z*ky;
	fprintf(out,"SOLUTION\n%.6lf\n",c);
	for(i=0;i<n;++i)
		fprintf(out,"%.6lf %.6lf %.6lf\n",p[i].x,p[i].y,p[i].z);
	return 0;
}