Search for WW gamma and WZ gamma production and constraints on anomalous quartic gauge couplings in pp collisions at sqrt(s) = 8 TeV