Note that angle QAB has measure 90 - x.
Also, cos(QAB) = QB/AB = QB/18, so QB = 18(cos(90-x)).
Similarly, cos(CBR) = BR/27, so BR = 27(cos(x)).
Note that QB + BR = 30 (the bottom part of your diagram).
So, 18(cos(90-x)) + 27(cos(x)) = 30.
Use the fact that the graph of cosine is the same as the graph of sine (just shifted) to convert cos(90-x) to sin(x).
Finally, divide everything by 3.