Yeah, it's just a simple rule. As I was taught:

If you В-it to get there, you ИЗ-it to leave it,
If you НА-it to geth there, you С-it to leave it,
If you К-it to get there, you ОТ-it to leave...