#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <math.h>

using namespace std;

typedef vector<int> VI;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<double, double> PDD;


#define REP(i,n) for (int i = 0; i < (n); i++)
#define IREP(i,n) for (i = 0; i < (n); i++)

PDD findEX(double x1, double z1, double x2, double z2) {
   double e = (x2-x1)/(z2-z1);
   return PDD(x1-e*z1, e);
}

vector<PDD> xs;
vector<PDD> ys;
VD zs;

bool check(PDD t) {
   REP(i, zs.size()) {
      if (t.first + t.second*zs[i] > xs[i].second + 1E-10) return false;
      if (t.first + t.second*zs[i] < xs[i].first - 1E-10) return false;
   }
   return true;
}


int main()
{
   ifstream ifs("gunman.in");
   ofstream ofs("gunman.out");

   int n;
   ifs >> n;
   REP(i, n) {
      double x1,y1,x2,y2,z;
      ifs >> x1 >> y1 >> x2 >> y2 >> z;
      xs.push_back(PDD(x1, x2));
      ys.push_back(PDD(y1, y2));
      zs.push_back(z);
   }

   double minf = -1E20;
   double maxf = 1E20;

   for (i = 0; i < n; ++i) {
      if (ys[i].second / zs[i] < maxf) maxf = ys[i].second / zs[i];
      if (ys[i].first / zs[i] > minf) minf = ys[i].first / zs[i];
   }

   if (maxf-minf < -1E-10) {
      ofs << "UNSOLVABLE" << endl;
      return 0;
   }

   PDD t;
   bool found = false;
   for (i = 0; i < n; ++i) {
      for (int j = i+1; j < n; ++j) {
         t = findEX(xs[i].first, zs[i], xs[j].first, zs[j]);
         if (check(t)) { found = true; break; }
         t = findEX(xs[i].second, zs[i], xs[j].first, zs[j]);
         if (check(t)) { found = true; break; }
         t = findEX(xs[i].first, zs[i], xs[j].second, zs[j]);
         if (check(t)) { found = true; break; }
         t = findEX(xs[i].second, zs[i], xs[j].second, zs[j]);
         if (check(t)) { found = true; break; }
      }
      if (found) break;
   }

   if (!found) {
      ofs << "UNSOLVABLE" << endl;
      return 0;
   }

   ofs << "SOLUTION" << endl;
   char buf[200];
   sprintf(buf, "%.6f", t.first);
   ofs << buf << endl;
   double f = minf;
   for (i = 0; i < n; ++i) {
      double x = t.first + t.second*zs[i];
      double y = zs[i]*f;
      sprintf(buf, "%.6f %.6f %.6f\n", x, y, zs[i]);
      ofs << buf;
   }

   return 0;
}