The probability of getting a card less than 7 is 2/3, and picking a card greater than 5 is 2/3 too, so I believe that now you just have to multiply them: 2/3 * 2/3 = 4/9, and that, I believe, is your answer.
Since 5 is being multiplied with q dividing both sides by 5 would cancel out the 5 from 5q leaving us with q and on the other side of the equal sign 5/7 or 1.4 is going to be the value of q