I am trying to prove that if
$$(A \times B) \times C = A \times (B \times C)$$
Then either $A = \emptyset, B = \emptyset$ or $C = \emptyset$.
So far I start of by assuming the equivalence and that $A \neq \emptyset, B \neq \emptyset$ and $C \neq \emptyset$. This gives $a \in A, b \in B, c \in C$ such that $((a,b), c) \in (A \times B) \times C $ and $((a,b), c)\in A \times (B \times C)$, whence $(a, b) \in A \times B$ and $(a, b) \in A$ and $c \in C$ and $c \in B \times C$, so that $A \times B = A$ and $B \times C = C$.
I understand on an intuitive level that $A \times B \neq A$, unless they are both empty (and likewise for $B \times C = C$, but what rules it out formally (in particular, what axiom or chain of reasoning in ZFC would rule it out)?