CT and MA tax return

I worked less than a month for the State of Connecticut remotely in 2021, then moved to a company in MA. My wife works remotely for the State of Connecticut remotely in 2021 until August, then worked mostly remotely (she went to the office once a week). We lived in MA in 2021, and file jointly. Do we have to file tax return for both states? Thank you!!