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


void UNSOLVABLE()
{
	printf("UNSOLVABLE\n");
	exit(0);
}

int n;

#define MAX 110
double x1[MAX],x2[MAX],y1_[MAX],y2_[MAX],z[MAX];
double xmin = -1e50, xmax = 1e50;
double alpha,beta;

void check(int i, int j)
{
	double xl, xr;
	xl = x2[i] + z[i]/(z[j]-z[i])*(x2[i]-x1[j]);
	xr = x1[i] + z[i]/(z[j]-z[i])*(x1[i]-x2[j]);
	double yl, yr;
	yr = y2_[i] + z[i]/(z[j]-z[i])*(y2_[i]-y1_[j]);
	yl = y1_[i] + z[i]/(z[j]-z[i])*(y1_[i]-y2_[j]);
	
	if(yl<0 || yr>0)
		UNSOLVABLE();
	if(xl > xr)
		UNSOLVABLE();
	if(xl > xmin)	
		xmin = xl;
	if(xr < xmax)
		xmax = xr;
	if(xmin > xmax)
		UNSOLVABLE();
}

int main()
{
	freopen("gunman.in","rt",stdin);
	freopen("gunman.out","wt",stdout);
	scanf("%d", &n);
	int i,j;
	for(i=0;i<n;i++){
		scanf("%lf %lf %lf %lf %lf",&x1[i],&y1_[i],&x2[i],&y2_[i],&z[i]);
		for(j=0;j<i;j++)
			check(i,j);
	}
	printf("SOLUTION\n%.6lf\n", xmin);
	alpha = atan2((x1[0]-xmin) ,z[0]);
	beta = atan2(y1_[0],z[0]);
	for(i=1;i<n;i++){
		double alpha1, beta1;
		alpha1 = atan2((x1[i]-xmin) ,z[i]);
		beta1 = atan2(y1_[i],z[i]);
		if(alpha1 > alpha)
			alpha = alpha1;
		if(beta1 > beta)
			beta = beta1;
	}
	for(i=0;i<n;i++){
		printf("%.6lf %.6lf %.6lf\n", xmin + z[i]*tan(alpha), z[i]/tan(beta), z[i]);
	}
	return 0;
}
