build nested relations of infinite depth