n = int(input()) s = input() t = input() q = int(input()) s = [x for x in s] t = [x for x in t] for i in range(q): c, x, y = input().split() if c == 'S': s[int(x)-1] = y else: t[int(x)-1] = y if s > t: print('>') elif s < t: print('<') else: print('=')