#include <iostream>
#include <algorithm>

class cool { 
public: 
  int a, b; 
  bool operator<(const cool& rhs) const 
  { 
    return a < rhs.a || a == rhs.a && b > rhs.b; 
  }
}; 

int main()
{ 
  cool arr[5] = {{2, 1}, {2, 3}, {2, 2}, {3, 1}, {1, 1}};
  std::sort(arr, arr+5);
  for (int i = 0; i < 5; ++i) 
  {
    std::cout << '(' << arr[i].a << ", " << arr[i].b << ") ";	
  }
}