Measurement of the differential cross sections for top quark pair production as a function of kinematic event variables in pp collisions at sqrt(s) = 7 and 8 TeV