what two large alliances took shape before the beginning of world war 1