Searches for light- and heavy-flavour three-jet resonances in pp collisions at $\sqrts = 8$ TeV