Add missing brackets while printing powers of Rational numbers

fixes #8409
Merge pull request #8418 from skirpichev/8409-fix

Add missing brackets while printing powers of Rational numbers