N = int(input()) S = input() T = input() Q = int(input()) for _ in range(Q): s = input().split() c, x, y = s[0], int(s[1]), s[2] if c == 'S': S = S[0:x-1] + y + S[x:] else: T = T[0:x-1] + y + T[x:] print('>' if S > T else ('<' if S < T else '='))