#include struct cand { std::string name; int grade, ref; cand() { } cand(const std::string& n, int g, int r) : name(n), grade(g), ref(r) { } bool operator>(const cand& c) const { return grade != c.grade ? grade > c.grade : ref > c.ref; } }; std::ostream& operator<<(std::ostream& os, const cand& c) { return os << c.name; }