How do you deposit a check that has both a custodian and beneficiary on the pay to the order of line?

Write "For Deposit Only" on the back. Both people have to sign it. If you are one of those people and you want to deposit it to your account you would sign first.