1435 - 从中序与后序遍历序列构造二叉树

通过次数

4

提交次数

4

Time Limit : 1 秒
Memory Limit : 128 MB

给定两个整数数组 inorderpostorder ,其中 inorder 是二叉树的中序遍历, postorder 是同一棵树的后序遍历,请你构造并输出这颗 二叉树

Input

第一行为整数n,表示数有n个节点

第二行为n个整数,表示以中序遍历树时所经过的各个节点值

第三行为n个整数,表示以后序遍历树时所经过的各个节点值

Output

以层序遍历时所经过的各个节点值

Examples

Input

5
9 3 15 20 7
9 15 7 20 3

Output

3 9 20 15 7

Input

1
-1
-1

Output

-1