After a whole semester's learning, professor Bear is now examining your learning progress. She knows that some of you never take homework seriously or resubmit the problem that had failed in the past exam, so she decided to introduce you to a problem that is based on past problems one more time.
But it would be cruel for professor Bear to do such things and let most of you get 0 scores on this problem, so she would provide some hints from some of the "electric gods" in the computer science department. But yet, inevitably to mention, some of the hints might be wrong since those "electric gods" aren't all quite "有料".
So you have to distinguish the correct hints yourself, based on your observation about these "electric gods". Maybe you don't know who they are, maybe they are all wrong. After all, you have to count on your own. But let's take a look at what they said first.
With a glance at what those "electric gods" had said, you may be helped to solve the problem below:
Given a string \(s\) that consists of only lowercase Latin characters, there are \(Q\) operations to apply on this string.
There are 4 types of operations, with the following 4 forms:
For operation of type \(1\), you have to turn every \(A\) in the given string to \(B\).
For operation of type \(2\), you have to set the \(id\)th character to \(C\).
For operation of type \(3\), you have to swap the \(id_a\)th character and the \(id_b\)th character.
For operation of type \(4\), you have to circularly shift the string to the right for \(l\) characters, i.e., each \(s[i]\) now becomes \(s[j]\) such that \(j \equiv i-l \space mod \space (the \space length \space of \space the \space string)\).
After the \(Q\) operations, you should print the resulting string in one line(remember to print a new line character).
The first line contains a string \(s\), which consists of only lowercase Latin characters.
The second line contains an integer \(Q\).
The next \(Q\) lines, each contains an operation.
Print your answer in one line and end with a newline character.