"I visit the fifth city."
Translation:Quintam urbem visito.
Adjectives in Latin have to match their corresponding noun in case, number, and gender, but this doesn't automatically mean identical endings.
"Quintam" is a form of the adjective "quintus", which takes endings for first-declension nouns when paired with a feminine noun, or those for second-declension nouns when paired with a masculine or neuter noun. "Urbem" is a singular feminine accusative noun, so "quintus" gets a first-declension singular accusative ending, or "-am."