Let $Y$ be the minimal model for $C$. Recall that $Y$ exists, is unique, and is at-worst-nodal of relative dimension $1$ over $R$, see Semistable Reduction, Proposition \ref{models-proposition-exists-minimal-model} and Lemmas \ref{models-lemma-minimal-model-unique} and \ref{models-lemma-semistable} (applies because we have $X$). There is a contraction morphism $$ Y \longrightarrow Z $$ such that $Z$ is a stable family of curves of genus $g$ over $R$ (Lemma \ref{lemma-contract-prestable-to-stable}). We claim there is a unique isomorphism of models $X \to Z$. By symmetry the same is true for $X'$ and this will finish the proof. \medskip\noindent By Semistable Reduction, Lemma \ref{models-lemma-blowup-at-worst-nodal} there exists a sequence $$ X_m \to \ldots \to X_1 \to X_0 = X $$ such that $X_{i + 1} \to X_i$ is the blowing up of a closed point $x_i$ where $X_i$ is singular, $X_i \to \Spec(R)$ is at-worst-nodal of relative dimension $1$, and $X_m$ is regular. By Semistable Reduction, Lemma \ref{models-lemma-pre-exists-minimal-model} there is a sequence $$ X_m = Y_n \to Y_{n - 1} \to \ldots \to Y_1 \to Y_0 = Y $$ of proper regular models of $C$, such that each morphism is a contraction of an exceptional curve of the first kind\footnote{In fact we have $X_m = Y$, i.e., $X_m$ does not contain any exceptional curves of the first kind. We encourage the reader to think this through as it simplifies the proof somewhat.}. By Semistable Reduction, Lemma \ref{models-lemma-blowdown-at-worst-nodal} each $Y_i$ is at-worst-nodal of relative dimension $1$ over $R$. To prove the claim it suffices to show that there is an isomorphism $X \to Z$ compatible with the morphisms $X_m \to X$ and $X_m = Y_n \to Y \to Z$. Let $s \in \Spec(R)$ be the closed point. By either Lemma \ref{lemma-contract-basic-uniqueness} or Lemma \ref{lemma-contract-prestable-to-stable} we reduce to proving that the morphisms $X_{m, s} \to X_s$ and $X_{m, s} \to Z_s$ are both equal to the canonical morphism of Algebraic Curves, Lemma \ref{curves-lemma-characterize-contraction-to-stable}. \medskip\noindent For a morphism $c : U \to V$ of schemes over $\kappa(s)$ we say $c$ has property (*) if $\dim(U_v) \leq 1$ for $v \in V$, $\mathcal{O}_V = c_*\mathcal{O}_U$, and $R^1c_*\mathcal{O}_U = 0$. This property is stable under composition. Since both $X_s$ and $Z_s$ are stable genus $g$ curves over $\kappa(s)$, it suffices to show that each of the morphisms $Y_s \to Z_s$, $X_{i + 1, s} \to X_{i, s}$, and $Y_{i + 1, s} \to Y_{i, s}$, satisfy property (*), see Algebraic Curves, Lemma \ref{curves-lemma-characterize-contraction-to-stable}. \medskip\noindent Property (*) holds for $Y_s \to Z_s$ by construction. \medskip\noindent The morphisms $c : X_{i + 1, s} \to X_{i, s}$ are constructed and studied in the proof of Semistable Reduction, Lemma \ref{models-lemma-blowup-at-worst-nodal}. It suffices to check (*) \'etale locally on $X_{i, s}$. Hence it suffices to check (*) for the base change of the morphism ``$X_1 \to X_0$'' in Semistable Reduction, Example \ref{models-example-blowup} to $R/\pi R$. We leave the explicit calculation to the reader. \medskip\noindent The morphism $c : Y_{i + 1, s} \to Y_{i, s}$ is the restriction of the blow down of an exceptional curve $E \subset Y_{i + 1}$ of the first kind, i.e., $b : Y_{i + 1} \to Y_i$ is a contraction of $E$, i.e., $b$ is a blowing up of a regular point on the surface $Y_i$ (Resolution of Surfaces, Section \ref{resolve-section-minus-one}). Then $\mathcal{O}_{Y_i} = b_*\mathcal{O}_{Y_{i + 1}}$ and $R^1b_*\mathcal{O}_{Y_{i + 1}} = 0$, see for example Resolution of Surfaces, Lemma \ref{resolve-lemma-cohomology-of-blowup}. We conclude that $\mathcal{O}_{Y_{i, s}} = c_*\mathcal{O}_{Y_{i + 1, s}}$ and $R^1c_*\mathcal{O}_{Y_{i + 1, s}} = 0$ by More on Morphisms, Lemmas \ref{more-morphisms-lemma-check-h1-fibre-zero}, \ref{more-morphisms-lemma-h1-fibre-zero}, and \ref{more-morphisms-lemma-h1-fibre-zero-check-h0-kappa} (only gives surjectivity of $\mathcal{O}_{Y_{i, s}} \to c_*\mathcal{O}_{Y_{i + 1, s}}$ but injectivity follows easily from the fact that $Y_{i, s}$ is reduced and $c$ changes things only over one closed point). This finishes the proof.