Delete Nodes from BST(Run Error)

Why my code is giving run error?
https://ide.codingblocks.com/s/67435

Ques:
You are given an array A1 of integers. You have to form first Binary Search tree and then you are provided another array A2. You have to delete each node from the BST which is present in the array A2. Now you have to print preorder traversal of the tree.

Input Format:
First line contains integer t as number of test cases. Each test case It contains four lines. First line contains integer n which represents the length of the array A1 and next line contains n space separated integers. Similarly third line contains integer m which represents the length of the array A2 and next line contains m space separated integers.

Constraints:
1 < t < 100 1< n,m < 1000

Output Format
Print the preorder of the tree

Sample Input
1
7
5 3 2 4 7 6 8
3
2 3 5
Sample Output
4 7 6 8

@pratyush63 hey pratyush there is small mistake in main and delete function i have modified you code you can refer this.