Lufthansa agrees deal to avert strikes