Search for massive resonances in dijet systems containing jets tagged as W or Z boson decays in pp collisions at sqrt(s) = 8 TeV