Gamma-ray flaring activity of NGC1275 in 2016-2017 measured by MAGIC