For 2016 you'll have to settle on a start date for your residency. If you moved into MA in August, then the day you arrived will be fine. For an end date -- if you're still living there -- you'll use Dec 31, 2016 since the tax return is concerned with only that particular tax year.
If you're not still living there, then your end date will be the date in 2016 when you moved out of state.