First results from the IllustrisTNG simulations: a tale of two elements - chemical evolution of magnesium and europium