Lived part time in NJ and NY

I lived 9 months in NJ and 3 months in NY during 2023. How do I file my taxes?

Do I have to file as part time resident on both states and also as par time non- resident on both ?

I am a little confused.

Also the W2 copy of NJ doesn't have any taxes withheld.