compare tree values