Three-way merge