

A strict binary tree is a tree where each node has either 0 or 2 children.
The first line contains an integer 'T' which denotes the number of test cases to be run. Then the test cases follow.
The first line of each test case contains an integer ‘N’ which denotes the number of nodes in the binary tree or the number of elements in the given arrays/lists.
The second line of each test case contains ‘N’ single space-separated integers denoting the preorder traversal of the binary tree, i.e. (‘PRE’).
The third line of each test case contains ‘N’ single space-separated characters with values either ‘L’ or ‘N’ denoting whether the corresponding node is a leaf or a non-leaf node (‘TYPENL’).
For each test case, print a single line that contains space-separated characters for each node which can be either 'N' or 'L'.
You don’t need to print anything, it has already been taken care of.
1 <= 'T' <= 100
1 <= 'N' <= 3000
1 <= 'VAL' <= 10 ^ 5
Where ‘T’ is the number of test cases, and ‘N’ is the total number of nodes in the binary tree, and “VAL” is the value of the binary tree node.
Time Limit: 1 sec
Our approach is to take account of the properties of a strict binary tree and accordingly apply the same for assigning the left and right child of a particular node in a binary tree. All we need to do is to is recursively apply the properties to both left and right subtrees of a binary tree.
The steps are as follows: