#include <iostream>
#include <iterator>
#include <vector>
#include <unordered_map>
#include <algorithm>

int main() {
	std::vector<int> v;
	typedef std::unordered_multimap<int, int> MapType;

	MapType m { { 1, 1 }, { 1, 2 }, { 2, 1 }, { 2, 2 }, { 3, 1 } };
	std::for_each(begin(m), end(m), [&](MapType::value_type i){v.push_back(i.second); });
	std::copy(begin(v), end(v), std::ostream_iterator<int>(std::cout, " "));

	return 0;
}