I came up with this proposition and a proof of it, but I am not sure if it is correct.
Proposition. If $X_1,\ldots,X_n,Y_1,\ldots,Y_n$ are (real-valued) random variables such that the two random vectors $(X_1,\ldots,X_n),\ (Y_1,\ldots,Y_n)$ have the same law (distribution), then we have ${\rm law}(X_j)={\rm law}(Y_j)$ for all $j$.
Proof. For any measurable set $B\subset\mathbb R$, we have $$\{X_1\in B\}=\{(X_1,\ldots,X_n)\in B\times\mathbb R\times\cdots\times\mathbb R\}\\ =\{(Y_1,\ldots,Y_n)\in B\times\mathbb R\times\cdots\times\mathbb R\}=\{Y_1\in B\}$$ Therefore, $P[X_1\in B]=P[Y_1\in B]$. Since this holds for all measurable sets $B$, by definition, $X_1$ and $Y_1$ have the same law. The proof for other pairs of components is similar.
Thanks in advance
Update:
The equality $\{(X_1,\ldots,X_n)\in B\times\mathbb R\times\cdots\times\mathbb R\}=\{(Y_1,\ldots,Y_n)\in B\times\mathbb R\times\cdots\times\mathbb R\}$ is not necessarily true. This should be changed to the following:
$$\{X_1\in B\}=\{(X_1,\ldots,X_n)\in B\times\mathbb R^{n-1}\}$$ $$\{Y_1\in B\}=\{(Y_1,\ldots,Y_n)\in B\times\mathbb R^{n-1}\}$$ $$\implies P[X_1\in B]=P[(X_1,\ldots,X_n)\in B\times\mathbb R^{n-1}]\\ =P[(Y_1,\ldots,Y_n)\in B\times\mathbb R^{n-1}]=P[Y_1\in B]$$
Just because the laws of $(X_1,\dotsc, X_n)$ and $(Y_{1}, \dotsc, Y_n)$ coincide does not mean that the events $((X_1,\dotsc, X_n)\in B\times \mathbb{R}^{n-1})$ and $((Y_1,\dotsc, X_n)\in B\times \mathbb{R}^{n-1})$ are equal as sets, only that they have the same probability. Other than that the proof is fine.