Production of proton-antiproton and kaon-antikaon pairs in four-body reactions of 8 GeV/c π+ and 10 GeV/c K− on protons