#include <stdio.h>
#define MAX 128

int n;
int x1[MAX],x2[MAX],y1[MAX],y2[MAX],z[MAX];
double resX[MAX],resY[MAX];

int main() {
	int i,j,k;

	freopen("gunman.in", "rt", stdin);
	freopen("gunman.out", "wt", stdout);

	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);

	int lowZ=1,lowY=0;
	for (i=0; i<n; i++) {
		if (z[i]*lowY - y1[i]*lowZ < 0) {
			lowY = y1[i];
			lowZ = z[i];
		}
	}
	int hiZ=0,hiY=1;
	for (i=0; i<n; i++) {
		if (z[i]*hiY - y2[i]*hiZ > 0) {
			hiY = y2[i];
			hiZ = z[i];
		}
	}
//	printf("%d %d\n", lowZ, lowY);
//	printf("%d %d\n", hiZ, hiY);

	if (lowZ*hiY - lowY*hiZ < 0) {
		puts("UNSOLVABLE");
		return 0;
	}

	for (i=0; i<n; i++)
		for (j=i+1; j<n; j++) {
			for (k=0; k<n; k++) {
				int tmp = (x2[j]-x1[i])*(z[k]-z[i]);
				if ((x1[k]-x1[i])*(z[j]-z[i]) > tmp) break;
				if ((x2[k]-x1[i])*(z[j]-z[i]) < tmp) break;
				resX[k] = (double)tmp/(z[j]-z[i]) + x1[i];
				resY[k] = (double)(lowY*z[k])/lowZ;
			}
			if (k==n) {
				puts("SOLUTION");
				printf("%.6lf\n", (double)((x2[j]-x1[i])*(-z[i]))/(z[j]-z[i]) + x1[i]);
				for (k=0; k<n; k++)
					printf("%.6lf %.6lf %d.000000\n", resX[k], resY[k], z[k]);
				return 0;
			}
		}

	puts("UNSOLVABLE");
	return 0;
}