Heavenly Stem Relationship
The Five Elements are Metal, Water, Wood, Fire and Earth. They can be broken down into Yin and Yang as Yang Wood, Yin Wood, Yang Fire, Yin Fire, Yang Earth, Yin Earth, Yang Water and Yin Water . They also have attraction and enmity interrelationships.
A lot of ancient Chinese philosophy came from observing the laws of nature. One legend tells of how ancient Chinese philosophers saw a diagram just like this on the back of a horse (maybe a hippopotamus) coming out of a river. One and six are at the bottom, two and seven are on the top, three and eight are on the left, and four and nine on the right and five and ten are at the center. Odd (Yang) and even (Yin) numbers are together just like husband and wife. So they applied this numerology to the Heavenly Stem sequence.
There is an Attraction relationship when the difference of two Stem sequences is five.
For example, on the Chinese Fortune Calendar if your DAY stem is a Yang Wood (1), and the Yin Earth (6) represents your spouse, there is a difference of the two numbers is five. In the above chart, Yin Water represents your mother (Water helps Wood grow and Yin is the female sex) and Yang Earth represents your father (Yang Earth and Yin Water love each other).
Enmity Relationship (Fighting)
The enmity relationship is determined from the position of elements. Ancient Chinese considered "face to face" as the enmity relationship. Wood is in the east and faces Metal in the West. Water is in the north and faces Fire in the south. They dislike each other, so they live in opposite places. When Yang meets Yang or Yin meets Yin, they reject each other which is also natural.
There is an Enmity relationship when the difference of two Stem sequences is six.