Search for high-mass Z gamma resonances in proton-proton collisions at root s=8 and 13 TeV using jet substructure techniques