Elgar, Duminy put South Africa on top vs. Australia