```
int findSecondMinimumValue(TreeNode* root) {
int res = findMin(root,root->val);
return res == INT_MAX?-1:res;
}
int findMin(TreeNode* root, int first_min){
if(root){
if(root->val!=first_min) return root->val;
int left = findMin(root->left,first_min);
int right = findMin(root->right,first_min);
return min(right,left);
}
return INT_MAX;
}
```