unite and solve the problem