YORP Effect on Asteroid 162173 Ryugu: Implications for the Dynamical History