#include <fstream>

using namespace std;

ifstream fin( "gunman.in" );
ofstream fout( "gunman.out" );

const int MAX_N = 100;

struct SWindow
{
   int SX, SY, EX, EY, Z;
};

int N;
SWindow Windows[ 1 + MAX_N ];

int CanShoot;
double X;

int HSX, HSZ;
int HEX, HEZ;

int VSY, VSZ;
int VEY, VEZ;

int Det( int m11, int m12, int m21, int m22 )
{
   return m11 * m22 - m12 * m21;
}

void GetCross( double *x, double *y, 
   int sx1, int sy1, int ex1, int ey1,
   int sx2, int sy2, int ex2, int ey2 )
{
   int D = Det( 
      ex1 - sx1, sx2 - ex2,
      ey1 - sy1, sy2 - ey2 );
   int Du = Det( 
      sx2 - sx1, sx2 - ex2,
      sy2 - sy1, sy2 - ey2 );

   double u = ( double )Du / D;
   *x = sx1 + u * ( ex1 - sx1 );
   *y = sy1 + u * ( ey1 - sy1 );
}

bool IsCrossing(
   int sx1, int sy1, int ex1, int ey1,
   int sx2, int sy2, int ex2, int ey2 )
{
   int D = Det( 
      ex1 - sx1, sx2 - ex2,
      ey1 - sy1, sy2 - ey2 );
   int Du = Det( 
      sx2 - sx1, sx2 - ex2,
      sy2 - sy1, sy2 - ey2 );
   int Dv = Det( 
      ex1 - sx1, sx2 - sx1,
      ey1 - sy1, sy2 - sy1 );

   if( D > 0 )
   {
      if( Dv >= 0 && Dv <= D )
         return true;
   }
   else if( D < 0 )
   {
      if( Dv <= 0 && Dv >= D )
           return true;
   }

   return false;
}

void ReadData()
{
   int i;

   fin >> N;


   for( i = 1; i <= N; i++ )
   {
      fin >> Windows[ i ].SX >> Windows[ i ].SY; 
      fin >> Windows[ i ].EX >> Windows[ i ].EY;
      fin >> Windows[ i ].Z; 
   }
}

void Work()
{
   int i, j, k;

   CanShoot = false;


   for( i = 1; i <= N; i++ )
   {
      for( j = 1; j <= N; j++ )
      {
         if( i == j )
            continue;

         for( k = 1; k <= N; k++ )
         {
            if( !IsCrossing( 
               Windows[ i ].SX, Windows[ i ].Z, Windows[ j ].EX, Windows[ j ].Z,
               Windows[ k ].SX, Windows[ k ].Z, Windows[ k ].EX, Windows[ k ].Z ) )
            {
               goto Break;
            }
         }
         CanShoot = true;
        
         HSX = Windows[ i ].SX;         
         HSZ = Windows[ i ].Z;
         HEX = Windows[ j ].EX;         
         HEZ = Windows[ j ].Z;

         goto Success;

Break:;
      }
   }

   return;
Success:

   for( i = 1; i <= N; i++ )
   {
      for( j = 1; j <= N; j++ )
      {
         if( !IsCrossing( 
            0, 0, Windows[ i ].SY, Windows[ i ].Z,
            Windows[ j ].SY, Windows[ j ].Z, Windows[ j ].EY, Windows[ j ].Z ) )
         {
            goto Break2;
         }
      }
      VSY = 0;
      VSZ = 0;
      VEY = Windows[ i ].SY;
      VEZ = Windows[ i ].Z;
      return;
Break2:;
   }

   CanShoot = false;
}

void Output()
{
   int i;

   if( !CanShoot )
   {
      fout << "UNSOLVABLE";
      return;
   }


   double x0, z0;

   GetCross( &x0, &z0, 
      HSX, HSZ, HEX, HEZ, 
      0, 0, 1, 0 );

   fout << "SOLUTION" << endl;

   fout.setf( ios::fixed );
   fout.precision( 6 );
   fout << x0 << endl;

   for( i = 1; i <= N; i++ )
   {
      double x, y, z;

      GetCross( &x, &z, 
         HSX, HSZ, HEX, HEZ, 
         Windows[ i ].SX, Windows[ i ].Z, Windows[ i ].EX, Windows[ i ].Z );
      
      GetCross( &y, &z, 
         VSY, VSZ, VEY, VEZ, 
         Windows[ i ].SY, Windows[ i ].Z, Windows[ i ].EY, Windows[ i ].Z );

      z = Windows[ i ].Z;

      fout << x << " " << y << " " << z << endl;
   }
}

int main()
{   
   ReadData();

   Work();

   Output();

   return 0;
}
