I'm retired and live in MA. I worked a temp job at my old company in CT but I was hired through the local office of a recruiter based in MD. Where do I file state taxes?

My W-2 has the MD address of the recruiter. In the past I filed a resident return in MA and a non-resident return in CT.