Are sentences 1 and 2 correct:

1-My Dad taught me how to play chess. It was worth it.


Meaning: It was worth it for me to learn to play chess. Learning to play chess was worth going through the trouble.


2-Life in the dormitory taught me how to get along with people. It was worth it.


Meaning: It was worth it for me to learn how to get along with people. Learning how to get along with people was worth going through the trouble.

Gratefully,
Navi.