Neeka gave one fifth of her mangoes to her brother, she sold five eighths of the remainder, she was left with 12 mangoes. How many mangoes did she have in the first place?

4/5 M*(3/8)=12

This says she has 3/8 of 4/5 of the original mangos.

Or you could do it the number sold:
1/5 M + 5/8(4/5)M= M-12