#include <bits/stdc++.h>
using namespace std;

int main() {
	
	auto cmp = [](auto& a , auto& b)
	{
		return a.first * a.second < b.first * b.second 
	       || (a.first * a.second ==  b.first * b.second && a.first < b.first);
	};
	
	priority_queue<pair<int,int> , vector<pair<int,int>> , decltype(cmp)> p(cmp);
	
	p.emplace(2 , 5);
	p.emplace(5 , 10);
	p.emplace(3 , 6);
	p.emplace(6 , 3);
	
	while(!p.empty())
	{
		auto t = p.top();
		p.pop();
		cout << t.first << " " << t.second << endl;
	}
	
	return 0;
}