I worked in NY through May 2018, then I moved to CT where I worked for four months, then I moved back to NY and worked to the end of 2018. How would I file my taxes?

New York has always been my primary residence, but I moved away for school for a few months and worked, then I moved back to New York and went back to my original job to finish out 2018.  I'm unsure of how to identify the residences.