Riccardo second as Hamilton wins German Grand Prix