dem, der, denen, dessen, deren — at home and around town.
Type the relative pronoun. The gender shown is the noun it refers to; the case comes from the pronoun's job in its own clause.
'To whom', and after helfen, danken, gehören, gefallen, vertrauen, antworten … The plural is denen — never den.
mit, bei, von, zu, aus, nach, vor — and in, an, auf for wo? The preposition comes first: mit dem, bei der, von denen.
'Whose'. dessen for masculine and neuter, deren for feminine and plural. The noun that follows never changes it.
Pairs that look alike. Is it 'to whom' or a Dativ verb (dem, der, denen), or 'whose' (dessen, deren)? A preposition before dessen/deren belongs to the noun after it.
Every case now. Ask what the pronoun does in its own clause: subject, direct object, to whom, after a preposition, or whose.