want to get sublist which has max value on specified index based on condition.

```
mainlist=[[['RD-2', 'a', 120], ['RD-2', 'b', 125], ['RD-2', 'c', 127]], [['RD-3', 'a', 120], ['RD-3', 'b', 140]], [['RD-5', 'a', 120]],[['RD-7', 'a', 122]]]

```

and another list

```
baselist=[['RD-2', 100],['RD-3', 200],['RD-5', 240]]

```

for every first sub-element in baselist, i need the 1 complete sublist from mainlist which has max value in 2nd index position.
the output should be 

```
flist=[['RD-2', 'c', 127],['RD-3', 'b', 140],['RD-5', 'a', 120]]

```

help me.