intern relationships in tree
final tested code