public static Node inorderSuccessor(Node root,int val)
	{
		if(root!=null)
		{
		if(root.data==val)
		{
			if(root.right!=null)
			{
				return minValue(root.right);
			}
			else
			{
				return maxAncestor;
			}
			
		}
		
		else if(root.data<val)
		{
			return inorderSuccessor(root.right, val);
		}
		else
		{
			maxAncestor=root;
			return inorderSuccessor(root.left, val);
		}
		
		}
		else
			return null;
	}