Union using balanced tree working