Adj. Noun  
masculine & neuter -ого #- & o-declensions
feminine -ой a-declension
The normal spelling rules apply:
Rule A applies to the ending -ы, so it is spelled -и after velars (к г х) and after noisy consonants other than ц (ч щ ш ж), e.g. рџчки.
Rule B applies to the endings -ого/-ой, so they are spelled -его/-ей when unstressed after noisy consonants, e.g. хорћшего, хорћшей.
Stems ending in palatalized consonants (like словђрь) and the sound /y/ (like истћрия) have endings spelled with palatal indicators (Genitive: словарї, истћрии).
masculine & neuter feminine
Нљт большћго ресторђна. (ресторђн) Нљт большћй шкћлы. (шкћла)
Нљт хорћшего словарї. (словђрь) Нљт хорћшей дІни. (дІня)
Нљт такћго слћва. (слћво) Нљт крђсной рџчки. (рџчка)
Нљт такћго музљя. (музљй) Нљт вторћй такћй истћрии. (истћрия)