(i) 658 failed in Physics
(ii) 166 failed in Physics and Chemistry
(iii) 372 failed in Chemistry, 434 failed in Physics and Maths
(iv) 590 failed in Maths, 126 failed in Maths & Chemistry.
Find the number of people who failed in (assuming that none is passed in all subjects).

We have the following equations:
a + b + c + d + e + f + g = 1000
a + b + d + e = 658b, + d = 166
b + d + c + f = 372.
d + e = 434 as in the figure.
d + e + f + g = 590 d + f = 126. Find the values.
Chemistry but not in Physics.