#include <stdio.h>

#define C 200

typedef long double real;

int n;
struct REC
{
	real x[2], y[2], z;
};

REC r[C];

struct END
{
	real t;
	int w;
};

END cut[2*C];
const real eps = 1e-10;

int find(real &ans)
{
	int i;
	real x = 1e+10, y = -1e+10;
	for (i = 0; i < 2*n; i++)
	{
		if (cut[i].w)
		{
			if (x > cut[i].t) x = cut[i].t;
		}
		else
		{
			if (y < cut[i].t) y = cut[i].t;
		}
	}
	ans = (x + y) / 2;
	return x > y - eps;
}

int main()
{
	int i, j, ii, jj, k;
	real x, dx, dy;
	real x0, x1, z0, z1;
	freopen("gunman.in", "rt", stdin);
	freopen("gunman.out", "wt", stdout);
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%Lf%Lf%Lf%Lf%Lf",
			&r[i].x[0], &r[i].y[0], &r[i].x[1], &r[i].y[1], &r[i].z);
	}
	for (i = 0; i < n; i++)
	{
		cut[2*i].t = r[i].y[0] / r[i].z;
		cut[2*i].w = 0;
		cut[2*i+1].t = r[i].y[1] / r[i].z;
		cut[2*i+1].w = 1;
	}
	if (find(dy))
	{
		for (i = 0; i < n; i++) for (j = 0; j < i; j++)
		{
			for (ii = 0; ii < 2; ii++) for (jj = 0; jj < 2; jj++)
			{
				x0 = r[i].x[ii]; z0 = r[i].z;
				x1 = r[j].x[jj]; z1 = r[j].z;
				x = (x0 * z1 - x1 * z0) / (z1 - z0);
				for (k = 0; k < n; k++)
				{
					cut[2*k].t = (r[k].x[0] - x) / r[k].z;
					cut[2*k].w = 0;
					cut[2*k+1].t = (r[k].x[1] - x) / r[k].z;
					cut[2*k+1].w = 1;
				}
				if (find(dx))
				{
					printf("SOLUTION\n");
					printf("%.8Lf\n", x + eps);
					for (k = 0; k < n; k++)
					{
						printf("%.8Lf %.8Lf %.8Lf\n",
							x + r[k].z * dx + eps, r[k].z * dy + eps, r[k].z + eps);
					}
					/*printf("%.6Lf\n", x + eps);
					for (k = 0; k < n; k++)
					{
						printf("%.6Lf %.6Lf %.6Lf\n",
							x + r[k].z * dx + eps, r[k].z * dy + eps, r[k].z + eps);
					}*/
					return 0;
				}
			}
		}
	}
	printf("UNSOLVABLE\n");
	return 0;
}