5711 - Tree Construction   

Description

 You are asked to construct a binary tree, and output the tree in certain order.

Input

The input is the inorder and preorder traversal sequences of a binary tree.

In each test case, there are 2 lines.

The inorder traversal sequence of the tree is in the first line, and the preorder one is in the second.

Output

 Please output the postorder traversal sequence of the tree.

Sample Input  Download

Sample Output  Download

Tags




Discuss