#include <iostream>
#include <vector>
#include <algorithm>

int main()
{
	std::vector<std::vector<double>> vector1 = {{4,3,5,3}, 
                                                {2,6,3,7}, 
                                                {6,8,5,1}, 
                                                {5,6,1,5}};
                                               
    std::sort(vector1.begin(),
              vector1.end(),
              [] (const std::vector<double> &a, const std::vector<double> &b)
              {
                  return a[3] < b[3];
              });
              
    for (auto &r : vector1)
    {
    	for (auto e : r)
    		std::cout << e << " ";
    	std::cout << std::endl;
    }
    
	return 0;
}