You can solve this problem by looking at the slopes: lines c and d will have the same slope [tex]m_{cd}[/tex], because they are parallel. Similarly, lines f and g will have the same slope [tex]m_{fg}[/tex], because they are parallel.
Now, if f and c are perpendicular, is means that
[tex]m_{cd}=-\dfrac{1}{m_{fg}}[/tex]
So, the complete scenario is the following: