Shami reduces S. Africa to 173/5 at lunch on Day 4