Not that badly damage then if they could do that ie driveshafts and braking systems intact or only need slight attention.
Edited edit: turns out the info was duff and the units are still in situ - so my guess was:
I'm going to hazard a guess that it was likely the rear half of the formation (the one that appears to have remained on the rails at all times). It'd make sense to move that one under its own power - the only damage visible on that one was the excessive movement of the coupler and (possibly though I can't say I noticed it) some front end damage from such movement.
Could be entirely wrong but that'd be my bet.
I would suspect (though, again, this is just my speculation), the derailed unit will either be dragged from the front (as the coupler was unaffected) or attached to an otherwise undamaged unit to be removed. Its pure speculation here and I could be entirely wrong, but I wouldn't be at all surprised if caution was being taken about using the coupler that was in use at the time of derailment. Looking at the pictures it moved well beyond its normal range - so may have suffered twist/deformation damage.