C can never terminate
after removing C ,D can’t be reached
the remaining grammer is
S→ a | aA | B,
A→ aB | λ,
B→Aa
after solving λ productions
S→ a | aA | B,
A→ aB
B→Aa
now unit productions
S→ a | aA | Aa,
A→ aAa
B→Aa
and now we can’t reach to B so we can remove it also
S→ a | aA | Aa,
A→ aAa