#include <vector>
#include <assert.h>
#include <algorithm>
#include <unordered_map>
#include <iostream>

class Node {
public:
    int a, b, c;
    Node(std::vector<int> v) {
        assert(v.size() > 2);
        std::sort(begin(v), end(v));
        a = v[0]; b = v[1]; c = v[2];
    }
};

int main() {
    auto hash = [](const Node& n){
        size_t res = 17;
        res = res * 31 + std::hash<int>()(n.a);
        res = res * 31 + std::hash<int>()(n.b);
        res = res * 31 + std::hash<int>()(n.c);
        return res;
    };
    auto equal = [](const Node& n1, const Node& n2){
    	return n1.a == n2.a && n1.b == n2.b && n1.c == n2.c;
    };
    std::unordered_map<Node, int, decltype(hash), decltype(equal)> m(8, hash, equal);

    std::vector<int> v {3, 8, 9};
    Node n(v);
    m[n] = 0;

    for (auto const &nd : m)
        std::cout << nd.first.a << ", " << nd.first.b << ", " << nd.first.c << ", "  << nd.second << std::endl;

	return 0;
}