5710 - Tree Construction   

Description

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

Input

The input is the inorder and postorder 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 postorder one is in the second.

Output

Please output the preorder traversal sequence of the tree.

Sample Input  Download

Sample Output  Download

Tags




Discuss