I lived in New Jersey and moved to NYC for 2 months and moved back to NJ in September how do I file

I lived in NJ from January to July then moved to NYC from July  to September and moved October back to NJ