-----Problem Statement-----
One of the things JEC is known for is its GR (Group Recreation) where juniors and seniors do friendly interaction ;P
As for the new session of 2020 seniors decided to have their first GR and give them some treat. Juniors were excited about it they came to college canteen aligned in a line and counted themselves one by one from left to right so that every junior gets his/her treat. But seniors played a game and they will treat only the ones who passes in this game. Game is simple all they need to do is to alternate their language (between Hindi and English) while telling their positions that is if the junior just before you told 2 in English you need to say 3 in Hindi . You do not want to be the one left without a treat. 
You are the junior standing at position $X$ from left and the counting could start from left or right you have to predict which number you have to speak and in which language when your turn comes.

-----Input:-----
- 
First line will contain $T$, number of testcases. Then the testcases follow. 
- 
Each testcase contains 2 lines first consist 2 space separated integers, $N$ (total count) , $X$ (your position from left), next line consist of 2 space separated characters  L or R (Direction from which counting starts L-left, R-Right) and H or E (the language to start counting).

-----Output:-----
For each testcase, output a single line consisting space seperated Integer P and Character L
where P is the number you will speak and L is the language (H or E).

-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq N \leq 120$
- $1 \leq X \leq N$

-----Sample Input:-----
2
15 5
L H
20 14
R E

*try to trim extra white spaces like new line during input in case of wrong answer

-----Sample Output:-----
5 H
7 E

-----EXPLANATION:-----
- When counting starts from left with H it alternates like H E H E H….. on the fifth position H comes
- When Count starts from right with E it alternates like E H E H E H E….. with E on the position of 14th student from right.

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
t = int(input())
while t:
	t = t - 1
	(n, x) = input().split()
	n = int(n)
	x = int(x)
	(d, l) = input().split()
	if d == 'L':
		p = x
	elif d == 'R':
		p = n - x + 1
	if p % 2 == 1:
		if l == 'H':
			lang = 'H'
		else:
			lang = 'E'
	elif p % 2 == 0:
		if l == 'H':
			lang = 'E'
		else:
			lang = 'H'
	print(p, lang)


for zz in range(int(input())):
	(n, x) = map(int, input().split())
	z = list(str(input()))
	(c1, c2) = (z[0], z[2])
	ans1 = x if c1 == 'L' else n + 1 - x
	ans2 = c2 if ans1 % 2 == 1 else 'E' if c2 == 'H' else 'H'
	print(ans1, ans2)


from sys import stdin
for _ in range(int(stdin.readline())):
	(n, x) = list(map(int, stdin.readline().split()))
	(d, l) = list(map(str, stdin.readline().split()))
	if d == 'R':
		x = n - x + 1
	if l == 'H':
		if x % 2 == 0:
			print(x, 'E')
		else:
			print(x, 'H')
	elif x % 2 == 0:
		print(x, 'H')
	else:
		print(x, 'E')


for _ in range(int(input())):
	(n, x) = map(int, input().strip().split())
	(lr, he) = input().strip().split()
	if lr == 'R':
		x = n - x + 1
	if he == 'H':
		if x % 2 == 0:
			ans = 'E'
		else:
			ans = 'H'
	elif he == 'E':
		if x % 2 == 0:
			ans = 'H'
		else:
			ans = 'E'
	print(x, ans)


t = int(input())
for i in range(t):
	nx = [int(i) for i in input().split()][:2]
	direct_lang = [i for i in input().split()][:2]
	n = nx[0]
	x = nx[1]
	direct = direct_lang[0]
	language = direct_lang[1]
	if direct == 'L':
		number_is = x
		index = x - 1
		if index % 2 == 0:
			language_is = language
		elif language == 'H':
			language_is = 'E'
		else:
			language_is = 'H'
	else:
		number_is = n - x + 1
		index = x - 1
		if (n - 1) % 2 == 0:
			if index % 2 == 0:
				language_is = language
			elif language == 'H':
				language_is = 'E'
			else:
				language_is = 'H'
		elif index % 2 != 0:
			language_is = language
		elif language == 'H':
			language_is = 'E'
		else:
			language_is = 'H'
	print(str(number_is) + ' ' + str(language_is))


for tt in range(int(input())):
	(n, p) = list(map(int, input().strip().split()))
	(d, l) = list(map(str, input().strip().split()))
	if d == 'L':
		if p & 1:
			print(p, l)
		else:
			if l == 'E':
				tl = 'H'
			else:
				tl = 'E'
			print(p, tl)
	else:
		np = n - p + 1
		if n & 1:
			if p & 1:
				tl = l
			elif l == 'E':
				tl = 'H'
			else:
				tl = 'E'
		elif p & 1:
			if l == 'E':
				tl = 'H'
			else:
				tl = 'E'
		else:
			tl = l
		print(np, tl)


t = int(input())
for i in range(t):
	(n, m) = [int(x) for x in input().split()]
	(a, b) = input().split()
	if a == 'L':
		d = m
	else:
		d = n - m + 1
	if d % 2 != 0:
		print(d, b)
	elif b == 'E':
		print(d, 'H')
	else:
		print(d, 'E')


for i in range(int(input())):
	(n, x) = map(int, input().split())
	(pos, lang) = input().split()
	if 'L' in pos:
		x = x
	elif 'R' in pos:
		x = n - x + 1
	if x % 2 == 0 and lang == 'H':
		print(f'{x} E')
	elif x % 2 == 0 and lang == 'E':
		print(f'{x} H')
	elif x % 2 != 0:
		print(f'{x} {lang}')


T = int(input())
for i in range(T):
	N = input().split()
	for i in range(len(N)):
		N[i] = int(N[i])
	X = input().split()
	if X[0] == 'L' and X[1] == 'H':
		if N[1] % 2 == 0:
			print(str(N[1]) + ' E')
		else:
			print(str(N[1]) + ' H')
	if X[0] == 'L' and X[1] == 'E':
		if N[1] % 2 == 0:
			print(str(N[1]) + ' H')
		else:
			print(str(N[1]) + ' E')
	if X[0] == 'R' and X[1] == 'E' and (N[0] % 2 == 0):
		if N[1] % 2 == 0:
			print(str(N[0] - N[1] + 1) + ' E')
		else:
			print(str(N[0] - N[1] + 1) + ' H')
	if X[0] == 'R' and X[1] == 'E' and (N[0] % 2 != 0):
		if N[1] % 2 == 0:
			print(str(N[0] - N[1] + 1) + ' H')
		else:
			print(str(N[0] - N[1] + 1) + ' E')
	if X[0] == 'R' and X[1] == 'H' and (N[0] % 2 == 0):
		if N[1] % 2 == 0:
			print(str(N[0] - N[1] + 1) + ' H')
		else:
			print(str(N[0] - N[1] + 1) + ' E')
	if X[0] == 'R' and X[1] == 'H' and (N[0] % 2 != 0):
		if N[1] % 2 == 0:
			print(str(N[0] - N[1] + 1) + ' E')
		else:
			print(str(N[0] - N[1] + 1) + ' H')


for i in range(int(input())):
	nx = input().split()
	n = int(nx[0])
	x = int(nx[1])
	lrhe = input().split()
	lr = lrhe[0]
	he = lrhe[1]
	if lr == 'L':
		print(x, end=' ')
		if x % 2 != 0:
			print(he)
		elif he == 'H':
			print('E')
		else:
			print('H')
	if lr == 'R':
		print(n - x + 1, end=' ')
		if n % 2 == 0:
			if x % 2 == 0:
				print(he)
			elif he == 'H':
				print('E')
			else:
				print('H')
		elif x % 2 == 0:
			if he == 'H':
				print('E')
			else:
				print('H')
		else:
			print(he)


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	(a, b) = map(str, input().split())
	if a == 'L' and b == 'H':
		if x % 2 == 0:
			print(x, 'E')
		else:
			print(x, 'H')
	elif a == 'L' and b == 'E':
		if x % 2 == 0:
			print(x, 'H')
		else:
			print(x, 'E')
	elif a == 'R' and b == 'H':
		if (n - x + 1) % 2 == 0:
			print(n - x + 1, 'E')
		else:
			print(n - x + 1, 'H')
	elif a == 'R' and b == 'E':
		if (n - x + 1) % 2 == 0:
			print(n - x + 1, 'H')
		else:
			print(n - x + 1, 'E')


t = int(input())
for _ in range(t):
	(n, x) = (int(x) for x in input().split())
	(s, l) = input().split()
	if s == 'R':
		x = n - x + 1
	if l == 'E':
		if x % 2 == 0:
			l = 'H'
		else:
			l = 'E'
	elif l == 'H':
		if x % 2 == 0:
			l = 'E'
		else:
			l = 'H'
	print(x, l)


tt = int(input())
for _ in range(tt):
	(n, x) = map(int, input().rstrip().split(' '))
	(s, l) = input().rstrip().split(' ')
	initial = l
	que = []
	for i in range(n):
		que.append(initial)
		if initial == 'H':
			initial = 'E'
			continue
		elif initial == 'E':
			initial = 'H'
			continue
	if s == 'R':
		dd = n - x + 1
		que = que[::-1]
		pp = que[-dd]
	else:
		dd = x
		pp = que[x - 1]
	print(dd, end=' ')
	print(pp)


t = int(input())
for _ in range(t):
	(n, x) = map(int, input().split())
	(k, l) = input().split()
	if k == 'L':
		number = x
	else:
		number = n + 1 - x
	if number % 2 == 0:
		if l == 'H':
			lang = 'E'
		else:
			lang = 'H'
	else:
		lang = l
	print(number, lang)


for _ in range(int(input())):
	(N, X) = map(int, input().split())
	(P, S) = map(str, input().split())
	if P == 'L':
		if X % 2 != 0:
			print('{} {}'.format(X, S))
		elif S == 'H':
			print('{} E'.format(X))
		else:
			print('{} H'.format(X))
	else:
		X = N - X + 1
		if X % 2 != 0:
			print('{} {}'.format(X, S))
		elif S == 'H':
			print('{} E'.format(X))
		else:
			print('{} H'.format(X))


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	(p, q) = input().split()
	char = ''
	pos = 0
	if p == 'L':
		pos = k
	else:
		pos = n - k + 1
	if pos & 1 == 1:
		char = q
	elif q == 'H':
		char = 'E'
	else:
		char = 'H'
	print(pos, char)


t = int(input())
for i in range(t):
	(a, b) = list(map(int, input().split()))
	(c, d) = input().split()
	if c == 'L':
		sonu = b
		if d == 'H':
			if sonu % 2 != 0:
				print(str(sonu), 'H')
			else:
				print(str(sonu), 'E')
		elif sonu % 2 != 0:
			print(str(sonu), 'E')
		else:
			print(str(sonu), 'H')
	else:
		sonu = a - b + 1
		if d == 'H':
			if sonu % 2 != 0:
				print(str(sonu), 'H')
			else:
				print(str(sonu), 'E')
		elif sonu % 2 != 0:
			print(str(sonu), 'E')
		else:
			print(str(sonu), 'H')


t = int(input())
while t:
	(n, p) = map(int, input().split())
	(s, l) = map(str, input().split())
	p_l = p
	p_r = n - p + 1
	l1 = 'H'
	if l == 'H':
		l1 = 'E'
	if s == 'L':
		if p_l % 2 == 1:
			print(f'{p_l} {l}')
		else:
			print(f'{p_l} {l1}')
			print()
	elif p_r % 2 == 1:
		print(f'{p_r} {l}')
	else:
		print(f'{p_r} {l1}')
	t -= 1


t = int(input())
for i in range(t):
	(n, x) = list(map(int, input().split()))
	(p, l) = input().split()
	if p == 'L':
		if x % 2 == 1:
			print(x, l)
		elif l == 'H':
			print(x, 'E')
		else:
			print(x, 'H')
	else:
		x = n - x + 1
		if x % 2 == 1:
			print(x, l)
		elif l == 'H':
			print(x, 'E')
		else:
			print(x, 'H')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	(direc, lang) = input().split()
	if direc == 'R':
		x = n - x + 1
	if lang == 'H':
		if x % 2 == 0:
			print(x, 'E')
		else:
			print(x, 'H')
	elif x % 2 == 0:
		print(x, 'H')
	else:
		print(x, 'E')