I have an array of tuples of type (int, char). It is sorted in lexicographical order:

```
[(0, 'a'), (0, 'b'), (0, 'c'), (1, 'a'), (1, 'b'), (1, 'c') ...]

```

I need to sort it by second element first and then by first element:

```
[(0, 'a'), (1, 'a'), ..., (0, 'b'), (1, 'b'), ..., (0, 'c'), (1, 'c'), ...]

```

What sorting algorithm fit this case the best?