1/5 of chicken John had is equal to 3/4 of Mark.
John sold 150 chickens while Mark bought 160.
The remider is in a ratio of 5:3, for John & Mark respectively.
What was the total number of chickens both had at first.
So J/5 = 3M/4
Then if J' is the amount that John had after the buying and selling, and M' is the amount Mark had after buying and selling, then the 5:3 ratio tells us that
3J'/8 = 5M'/8
We also know that J' = J - 150
and M' = M + 160.
So if we replace J' and M' with those
So we have two simultaneous equations with two unknowns: