Hello Kimoya.
According to similarity rules; there is a ratio between height of triangles; 12/4 = 3. that means corresponding sides of left triangle multiplied by 3 to get the sides of troangle on the right.
So 18/3 gives us x which is 6;
8*3 = y = 24
hope that helps