could you maybe talk to Z about whether they'd be comfortable with you bringing it up with your professor or whoever abt extending the deadline/grading you individually? If they're your friend I'd hope they'd be understanding about how this can impact you negatively as well to do all the work by yourself + help them to seek some support maybe if it......