public static Node treeDelete(Node root,Node z){
		if(z.left == null){
			root = transplant(root,z,z.right);
		}
		else if(z.right == null){
			root = transplant(root,z,z.left);
		}
		else{ 
			Node  y = minimum(z.right);
			if( y.p != z){
				root = transplant(root,y,y.right);
				y.right = z.right;
				y.right.p = y;
			}
			root = transplant(root,z,y);
			y.left = z.left;
			y.left.p = y;
		}
		return root;
	}