solved 1d, 1e and 1f