# 1439 : Let's Compare!!!! from sys import stdin colNum=int(stdin.readline()) intST=[0]*2 S=0 T=1 intST[S]=int(stdin.readline().rstrip()) intST[T]=int(stdin.readline().rstrip()) Q=int(stdin.readline()) for i in range(Q): c,x,y=stdin.readline().split() x=int(x)-1 y=int(y) if c=='S': tgt=S else: tgt=T nThCol=int(intST[tgt]/10**(colNum-(x+1))%10) intST[tgt]+=(y-nThCol)*10**(colNum-(x+1)) if intST[S]>intST[T]: print('>') elif intST[S]