```
class Solution
{
public int findSecondMinimumValue(TreeNode root)
{
if(root.left == null) return -1;
int left = (root.left.val == root.val) ? findSecondMinimumValue(root.left) : root.left.val;
int right = (root.right.val == root.val) ? findSecondMinimumValue(root.right) : root.right.val;
if(left == -1) return right;
if(right == -1) return left;
return Math.min(left, right);
}
}
```