\(A=\dfrac{x\left(x-y\right)}{y}\cdot\dfrac{y\left(x+y\right)}{x\left(x-y\right)}\cdot\dfrac{x^2+1}{x^2+2}=\dfrac{x^2+1}{x^2+2}\)
\(B=\dfrac{x-1}{3x}\cdot\dfrac{x\left(x+1\right)}{\left(x-1\right)\left(x+1\right)}\cdot\dfrac{x^2+x+1}{\left(x+1\right)^2}\)
\(=\dfrac{1}{3}\cdot\dfrac{\left(x^2+x+1\right)}{x+1}=\dfrac{x^2+x+1}{3x+3}\)