If you are a prisoner in this situation and you care only about yourself, the way to get the smallest sentence is to betray the other prisoner. No matter what, you get a shorter sentence when you betray than when you do not.