Ok, let’s take a look at this from a different perspective, without looking at x or y.
We know that the lower left angle, not looking at the intersecting line, is a 90 degree angle. The 40 degrees indicates that the remaining side is 50 degrees. Let’s call this angle A.
Now, still ignoring x and y, take a look at the top line and the bottom line. Notice that they are parallel, indicated by the red arrows. This means that the 90 degree angle you see at the lower left corner also applies to the upper left.
Finally, plugging in the 3y we see at the top, angle b is 3y=90.
We know that all triangles add up to 180 degrees. So, let’s set up that equation.
180=50+90+5x
180=140+5x
40=5x
x=8
That said; the answer to this is x=8, and y=30 (Sorry this took a while! I made a mistake halfway through.)