This is quite long and I hope you can follow this through.
#(6x^4)/(3x)=2x^3# (this is our first term)
#2x^3(3x+22)=6x^4+44x^2#
#6x^4-5x^3-18x^2-5x+2-(6x^4+44x^2)=6x^4-5x^3-18x^2-5x+2-6x^4-44x^2=-49x^3-18x^2-5x+2#
#-(49x^3)/(3x)=-(49x^2)/3# (this is our second term)
#-(49x^2)/3(3x+22)=-(49x^2)/3-(1078x^2)/3#
#-49x^3-18x^2-5x+2-(-(49x^2)/3-(1078x^2)/3)=-49x^3-18x^2-5x+2+(49x^2)/3+(1078x^2)/3=(1024x^2)/3-5x+2#
#((1024x^2)/3)/(3x)=(1024x)/9# (this is our third term)
#(1024x)/9(3x+22)=(1024x^2)/3+(22528x)/9#
#(1024x^2)/3-5x+2-((1024x^2)/3+(22528x)/9)=(1024x^2)/3-5x+2-(1024x^2)/3-(22528x)/9=-(22573x)/9+2#
#-((22573x)/9)/(3x)=-22573/27# (this is our fourth term)
#-22573/27(3x+22)=-(22573x)/27-496606/27#
#-(22573x)/9+2-(-(22573x)/27-496606/27)=-(22573x)/9+2+(22573x)/27+496606/27=496660/27#
#496660/(27(3x+22))# (this is our final term)
This gives us:
#2x^3-(49x^2)/3+(1024x)/9-22573/27+496660/(27(3x+22))#