The premise ∃x∃y∀z(x = z ∨ y = z) says that there exists at most two distinct values in the domain.
The conclusion ∀x∀y(¬x = y → ∀z(x = z ∨ y = z)) says that for any two distinct values in the domain, there does not exist a third.
Clearly we need to utilise existential elimination and universal introduction.
∃-elim here will be tricky.
The 'trick' is ...