from heapq import * from re import split n = int(input()) s, t = list(input()), list(input()) l = [] heapify(l) for i in range(n): if s[i] != t[i]: heappush(l, i) for _ in range(int(input())): c, x, y = input().split() x = int(x) if c == "S": s[x - 1] = y else: t[x - 1] = y if s[x - 1] != t[x - 1]: heappush(l, x - 1) while l: p = heappop(l) if s[p] != t[p]: print(">" if s[p] > t[p] else "<") heappush(l, p) break else: print("=")