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

using namespace std;

class book {
private:
	int y, m, d;
public:
	book(int y_, int m_, int d_) {
		y = y_;
		m = m_;
		d = d_;
	}
	int getY(){ return y; };
	int getM(){ return m; };
	int getD(){ return d; };
};

// true если a<b иначе false(a>b,a>=b)
bool comp(book a, book b) {
	if (a.getY() < b.getY()) {
		return true;
	}
	else if (a.getY() > b.getY()) {
		return false;
	}
	else if (a.getM() < b.getM()) {
		return true;
	}
	else if (a.getM() > b.getM()) {
		return false;
	}
	else if (a.getD() > b.getD()) {
		return false;
	}
	else if (a.getD() < b.getD()) {
		return true;
	}
	else {
		return false;
	}
}

int main()
{
	book b1(2020, 01, 10);
	book b2(2020, 02, 12);
	book b3(2010, 01, 10);
	book b4(2010, 01, 10);

	vector<book> v1{ b1, b2, b3, b4 };

	// сортировка
	sort(v1.begin(), v1.end(), comp);
	
	// вывод
	for (auto i : v1) {
		cout << i.getD() << ':' << i.getM() << ':' << i.getY() << '\n';
	};
}