I fostered a cat once. Six years later I got her back. She immediately recognized me and the house.
When I picked her up the second time she cried in the cat box all the way home. When I got to the door she stopped crying and she ran straight into the house. She walked around, sniffing every corner. Then she curled right up and fell asleep.
She recognized her pee smells.
In 2001 I adopted a wonderful, loving dog who’d been horribly abused as a puppy. The day he was brought to my house for his pre-adoption interview I walked him around the yard. He started leaning on me about half way through the walk and I knew it was going to work. Then we went into the house and he ran straight to the bedroom, jumped up on the bed, and made himself at home. We were that way for the next ten years until cancer took him.