N = int(input()) S = int(input()) T = int(input()) Q = int(input()) ans = [] for _ in range(Q): s = input().split() c, x, y = s[0], int(s[1]), int(s[2]) X = 10**(N-x) Y = y * X if c == 'S': X = ((S // X) % 10) * X S += -X + Y else: X = ((T // X) % 10) * X T += -X + Y ans.append('>' if S > T else ('<' if S < T else '=')) for a in ans: print(a)