{"raw_statement":[{"iden":"problem statement","content":"You are given a string $S$ of length $N$ consisting of lowercase English letters.\nYou will perform an operation $Q$ times on the string $S$. The $i$\\-th operation $(1\\leq i\\leq Q)$ is represented by a pair of characters $(c _ i,d _ i)$, which corresponds to the following operation:\n\n*   Replace all occurrences of the character $c _ i$ in $S$ with the character $d _ i$.\n\nPrint the string $S$ after all operations are completed."},{"iden":"constraints","content":"*   $1\\leq N\\leq2\\times10^5$\n*   $S$ is a string of length $N$ consisting of lowercase English letters.\n*   $1\\leq Q\\leq2\\times10^5$\n*   $c _ i$ and $d _ i$ are lowercase English letters $(1\\leq i\\leq Q)$.\n*   $N$ and $Q$ are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$\n$S$\n$Q$\n$c _ 1$ $d _ 1$\n$c _ 2$ $d _ 2$\n$\\vdots$\n$c _ Q$ $d _ Q$"},{"iden":"sample input 1","content":"7\natcoder\n4\nr a\nt e\nd v\na r"},{"iden":"sample output 1","content":"recover\n\n$S$ changes as follows: `atcoder` → `atcodea` → `aecodea` → `aecovea` → `recover`. For example, in the fourth operation, all occurrences of `a` in $S={}$`aecovea` (the first and seventh characters) are replaced with `r`, resulting in $S={}$`recover`.\nAfter all operations are completed, $S={}$`recover`, so print `recover`."},{"iden":"sample input 2","content":"3\nabc\n4\na a\ns k\nn n\nz b"},{"iden":"sample output 2","content":"abc\n\nThere may be operations where $c _ i=d _ i$ or $S$ does not contain $c _ i$."},{"iden":"sample input 3","content":"34\nsupercalifragilisticexpialidocious\n20\ng c\nl g\ng m\nc m\nr o\ns e\na a\no f\nf s\ne t\nt l\nd v\np k\nv h\nx i\nh n\nn j\ni r\ns i\nu a"},{"iden":"sample output 3","content":"laklimamriiamrmrllrmlrkramrjimrial"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}