Sorting a list of tuples by the last last elements of the tuple