A search for a heavy scalar boson H decaying into a pair of lighter standard-model-like 125 GeV Higgs bosons hh and a search for a heavy pseudoscalar boson A decaying into a Z and an h boson are presented. The searches are performed on a data set corresponding to an integrated luminosity of 19.7 fb−1 of pp collision data at a centre-of-mass energy of 8 TeV, collected by CMS in 2012. A final state consisting of two τ leptons and two b jets is used to search for the H→hhH→hh decay. A final state consisting of two τ leptons from the h boson decay, and two additional leptons from the Z boson decay, is used to search for the decay A→ZhA→Zh. The results are interpreted in the context of two-Higgs-doublet models. No excess is found above the standard model expectation and upper limits are set on the heavy boson production cross sections in the mass ranges 260<mH<350 GeV260<mH<350 GeV and 220<mA<350 GeV220<mA<350 GeV.