Failed to pass all testcases

"
import java.util.*;
public class Main {
public class Node{
int data;
Node left;
Node right;
}
private Node root;
public Main(int arr[]){
for(int i=0;i<arr.length;i++){
this.root=construct(arr[i],root);
}
}
private Node construct(int v,Node root){
if(root==null){
Node nn=new Node();
nn.data=v;
return nn;
}
if(v<root.data){
root.left=construct(v,root.left);
}
if(v>root.data){
root.right=construct(v,root.right);
}
return root;
}
public static void main(String args[]) {
Scanner scn=new Scanner(System.in);
int t=scn.nextInt();
while(t>0){
int n=scn.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++){
arr[i]=scn.nextInt();
}
int n1=scn.nextInt();
int del[]=new int[n1];
for(int i=0;i<n1;i++){
del[i]=scn.nextInt();
}
Main m=new Main(arr);
for(int i=0;i<n1;i++){
m.delete(del[i]);
}
m.preorder();
t–;
}

}
public void delete(int item){
	delete(this.root,null,false,item);
}
public void delete(Node node,Node parent,boolean ilc,int item){
    if(node==null){
		return ;
	}

	if(item<node.data){
		delete(node.left,node,true,item);
	}else if(item>node.data){
		delete(node.right,node,false,item);
	}else{
		if(node.left==null && node.right==null){
			if(ilc){
				parent.left=null;
				return ;
			}else{
				parent.right=null;
				return ;
			}
		}else if(node.left==null && node.right!=null){
			if(ilc){
				parent.left=node.right;
			}else{
				parent.right=node.right;
			}
		}else if(node.left!=null && node.right==null){
			if(ilc){
				parent.left=node.left;
			}else{
				parent.right=node.left;
			}
		}else{
			int val=min(node.right);
			node.data=val;
			delete(node.right,node,false,val);

		}

	}
}
public int min(Node root){
	if(root==null){
		return Integer.MAX_VALUE;
	}
	return Math.min(root.data,min(root.left));
}
public void preorder(){
	preorder(this.root);
}
private void preorder(Node root){
	if(root==null){
		return ;
	}
	System.out.print(root.data+" ");
	preorder(root.left);
	preorder(root.right);
}

}
"

@guptadev354,

https://ide.codingblocks.com/s/222425 Corrected code.
You need to add a condition if the parent node is null. I have corrected code and highlighted the lines I have added for your reference. Your logic and code was correct.