Nice exercise. Let $t=a_i/b_i\ne 1$ for $1\le i\le n-1$, and observe that we can assume wlog $t>1$ by reversing the roles of $a_i,b_i$ sequences. Furthermore, suppose also that $a_1<\cdots<a_{n-1}$ and so $b_1<\cdots<b_{n-1}$ with $a_i=tb_i$ for $1\le i\le n-1$. Using $\textstyle \prod_{1\le i\le n}a_i = \prod_{1\le i\le n}b_i$, we find $a_n =b_n/t^{n-1}$.
Next, suppose $a_n>a_1$. Then, $\min\{a_1,\dots,a_n\}=a_1$, and $\min\{b_1,\dots,b_{n-1},b_n\} \le b_1$. On the other hand, since $a_1=tb_1$ for $t>1$ and $\min\{a_1,\dots,a_n\} = \min\{b_1,\dots,b_n\}$, this yields a contradiction. So, $a_n<a_1<\cdots<a_{n-1}$. Likewise, if $b_n<b_{n-1}$ then $b_{n-1}=\max\{b_1,\dots,b_n\}=\max\{a_1,\dots,a_n\}=a_{n-1}$, contradicting with $a_{n-1}=tb_{n-1}$ for $t>1$. So, $b_1<\cdots<b_n$. Now set $a_n=a$. Then, $b_1=a$, $a_1=ta=b_2$, $a_2=t^2a=b_3$, and continuing in this manner, we establish the claim.