According to the endosymbiotic theory, which cellular process was involved in the evolution of mitochondria and chloroplasts?