Procat has some maps. But some of them are duplicated. He will give you two of them $X$ and $Y$, hoping you could determine whether they are the same or not.
Each map is a rooted tree. The tree consists of $N$ vertices, numbered from $1$ to $N$. There are exactly one simple path between any two vertices.
Procat will give you the map in a special format. The format is described by the following EBNF (Extended Backus–Naur form):
TREE := INT '(' TREE ')' '(' TREE ')' | NIL
It means that a tree is a integer followed by two subtrees or a NIL. The integer represents which vertex the root of the tree is. If the tree is a NIL, it means that the tree is empty.
Two maps are considered the same if and only if they have the same root and for every pair of vertices $(u, v)$ $(1 \le u, v \le N)$, which means the path from $u$ to $v$ in the first map is the same as the path from $u$ to $v$ in the second map.
Let's look at some examples. In the figure below, tree (a) will be represented as 1(2()())(3()())
, tree (b) as 1(3()())(2()())
, and tree (c) as 3(1(2()())())()
. However, only tree (a) and tree (b) are considered the same.
Input contains three lines. The first line contains an integer $N$, the number of vertices in each map.
For the following two lines, each line contains a string, representing map $X$ and $Y$ respectively in the EBNF format.
$N$
$X$
$Y$
'('
, ')'
and digits.If the two maps are the same, output "YES". Otherwise, output "NO".
Noted that you should output only one single line.