N = int(input()) S = list(input()) T = list(input()) Q = int(input()) for iiii in range(Q): c, x, y = input().split() x = int(x) - 1 if c == "S": S[x] = y else: T[x] = y if S > T: print(">") elif S == T: print("=") else: print("<")