naive solution to merge