Create a Binary Search Tree from list A containing N elements. Insert elements in the same order as given. Print the pre-order traversal of the subtree with root node data equal to Q (inclusive of Q), separating each element by a space.
Input:
First line contains a single integer N – number of elements.
Second line contains N space-separated integers.
Third line contains a single integer Q – the element whose subtree is to be printed in pre-order form.
Output:
Print K space-separated integers – where K is the number of elements in the subtree of Q (inclusive of Q)
Constraints: