loop over z