Explanation:
m = number of math books
s = number of science books
h = number of history books
m + h + s = 3s
m + h = 2s
s = m - 6
m + h = 2(m - 6) = 2m - 12
h = m - 12
and since s = m - 6, this also means
h = s - 6
that means, the number of History reference books is 12 less than the Mathematics reference books. which is then 6 less than the number of Science reference books.