N = int(input()) S = int(input()) T = int(input()) Q = int(input()) 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 print('>' if S > T else ('<' if S < T else '='))