N = int(input()) S = (input()) T = (input()) Q = int(input()) for i in range(Q): c = list(input().split()) if c[0] == 'T': T = T[:int(c[1]) - 1] + c[2] + T[int(c[1]):] else: S = S[:int(c[1]) - 1] + c[2] + S[int(c[1]):] tmpS = int(S) tmpT = int(T) if tmpS > tmpT: print('>') elif tmpT > tmpS: print('<') else: print('=')