#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

template <typename M, typename V>
void mapValToVec(const M &m, V &v){
	for (typename M::const_iterator it = m.begin(); it != m.end(); it++)
	{
		v.push_back(*it);
	}
}
bool comp(const pair<int, int> &a, const pair<int, int> &b){
	return a.second < b.second;
}
int main() {
    typedef map<int, int> Map;
    Map m = {{21, 55}, {11, 44}, {33, 11}, {10, 5}};
    vector<pair<int, int>> v;
    mapValToVec(m, v);
    std::partial_sort(v.begin(), v.begin()+3, v.end(), comp);
    for(int i = 0; i < 3; i++) cout << v[i].first << " " << v[i].second << " " <<endl;
	return 0;
}