Ltfh_Inf @ 2024-10-01 20:14:03
n = int(input())
str0 = input()
for _ in range(n):
list1 = input().split()
if list1[0] == "1":
str0 = str0 + list1[1]
print(str0)
elif list1[0] == "2":
a = int(list1[1])
b = int(list1[2])
str0 = str0[a : a + b]
print(str0)
elif list1[0] == "3":
str0 = str0[: int(list1[1])] + list1[2] + str0[int(list1[1]) :]
print(str0)
elif list1[0] == "4":
print(str0.find(list1[1]))
print()