N = int(input()) S = int(input()) T = int(input()) Q = int(input()) sl = len(str(S)) tl = len(str(T)) s = "" t = "" ok = True for ss in str(S): if ok: if len(str(S)) < N: for i in range(N-len(str(S))): s += "0" ok = False s += ss ok = True for ss in str(T): if ok: if len(str(T)) < N: for i in range(N-len(str(T))): t += "0" ok = False t += ss s = list(s) t = list(t) for _ in range(Q): A = list(map(str, input().split())) if A[0] == "S": s[int(A[1])-1] = A[2] else: t[int(A[1])-1] = A[2] sa = "".join(s) ta = "".join(t) if sa == ta: print("=") continue if sa > ta: print(">") continue else: print("<") continue