N = int(input()) S = input() T = input() Q = int(input()) D = 0 for i in range(N): if S[i] != T[i]: D = i+1 if S[i] > T[i] else -i-1 break def review(c, x): global N, S, T, D if c == 'S': if S[x-1] == y: return S = S[0:x-1] + y + S[x:] else: if T[x-1] == y: return T = T[0:x-1] + y + T[x:] if x < abs(D): D = x if S[x-1] > T[x-1] else -x elif x == abs(D): D = 0 for i in range(x-1, N): if S[i] != T[i]: D = i+1 if S[i] > T[i] else -i-1 break for _ in range(Q): s = input().split() c, x, y = s[0], int(s[1]), s[2] review(c, x) if D == 0: print('-') else: print('>' if D > 0 else '<')