N = int(input()) S = list(input()) Q = int(input()) for _ in range(Q): t, x, c = input().split() t = int(t) x = int(x) if t == 1: S[x - 1] = c elif t == 2: for i in range(N): S[i] = S[i].lower() else: for i in range(N): S[i] = S[i].upper() print("".join(S))