[would draw diagram to make easier].
We can use Newton's Second Law (F=ma) to resolve the forces acting on each of the blocks (label string on 3kg side T1 and on 4kg side T2, and looking at the diagram use the direction the system will accelerate as positive):
1: T1 - 3g = 3a (vertically up at 1st block)
2: T2 - T1 = 5a (horizontally to right at 2nd block)
3: 4g - T2 = 4a (vertically down at 3rd block).
Add all of the equations together to get g = 12a, so the acceleration, a = g/12.
Now, just substitute this back into the equations to get the tensions:
T1 = 3g + 3a = 3g + 3(g/12) = 13g/4
T2 = 4g - 4a = 4g - 4(g/12) = 11g/3.