generating data for parts a and d