#include <iostream>
#include <algorithm>
#include <memory>

typedef std::pair<int,int> Pair;

bool compare(const Pair& i, const Pair& j) { return i.first < j.first; }

int main() {
	const int N=5;
	Pair pairs[N] = {{1,2}, {7,8}, {13,14}, {4,5}, {10,11}};

	std::cout << "unsorted" << std::endl;
	for(int i=0; i<N;++i) std::cout << i << ": (" << pairs[i].first << ", " << pairs[i].second << ")" << std::endl;
	
	std::sort(pairs, pairs+N, compare);
	
	std::cout << "sorted" << std::endl;
	for(int i=0; i<N;++i) std::cout << i << ": (" << pairs[i].first << ", " << pairs[i].second << ")" << std::endl;
	
	return 0;
}