N = int(input()) S = list(map(int,list(input()))) T = list(map(int,list(input()))) from heapq import * lis = [] for i in range(N): if S[i]!=T[i]: heappush(lis, i) Q = int(input()) ans = ['=']*Q for i in range(Q): c,x,y = input().split() x = int(x); y = int(y) flag = S[x-1]==T[x-1] if c=='S': S[x-1] = y else: T[x-1] = y if flag and S[x-1] != T[x-1]: heappush(lis, x-1) while len(lis): ind = heappop(lis) if S[ind]>T[ind]: ans[i] = '>' heappush(lis, ind) break elif S[ind]