#include <iostream>
#include <map>

typedef std::map<double, std::pair<int, int>> DType;

DType MakeHoge(std::size_t M){
	DType R;
	double D = 0;
	for (std::size_t i = 2; i <= M; i++){
		for (std::size_t j = 1; j < i; j++){
			auto P = std::make_pair(j, i);
			D = j / static_cast<double>(i);
			if (D >= 1) continue;
			auto it = R.find(D);
			if (it == R.end()) R[D] = P;
		}
	}

	return R;

}

bool Show(DType M){

	for (auto& o : M)std::cout << o.second.first << '/' << o.second.second << '=' << o.first << std::endl;
	return true;
}

int main(){

	DType R;
	
	std::cout << "M == 3" << std::endl;
	R = MakeHoge(3);
	Show(R);
	std::cout << "M == 5" << std::endl;
	R = MakeHoge(5);
	Show(R);
	
	return 0;

}