Using all-atom molecular dynamics simulations of aqueous solutions of the globular protein SNase, the dynamic behavior of water molecules and cosolvents (trimethylamine-N-oxide (TMAO) and urea) in the hydration shell of the protein was studied for different solvent compositions. TMAO is a potent protein-stabilizing osmolyte, whereas urea is known to destabilize proteins. For molecules that are initially located in successive narrow layers at a given distance from the protein, the mean displacements and the distribution of displacements for short time intervals are calculated. For molecules that are initially located in solvation shells of a given thickness around the protein, the characteristic residence times in these shells are determined to characterize the dynamic behavior of the solvent molecules as a function of the distance to the protein. A combined consideration of these characteristics allows to reveal additional features of the dynamics of the cosolvents. It is shown that TMAO molecules leave the nearest vicinity of the protein faster than urea molecules, despite the fact that the mobility of TMAO molecules, measured by their mean displacements, is lower than that of urea. Moreover, we show that the rate of release of TMAO molecules from the hydration shell is lower in ternary (TMAO + urea + H2O) solvent mixtures than in the binary ones. This is consistent with a recent observation that the fraction of TMAO near the protein decreases in the presence of urea. From the analysis of the decay of the number of particles initially located in the region of the first peak of the distribution function of solvent molecules around the protein, we estimated that about 20 water molecules and 6-7 urea molecules stay near the protein for more than 1000 ps.