Chef recently printed directions from his home to a hot new restaurant across the town, but forgot to print the directions to get back home. Help Chef to transform the directions to get home from the restaurant.
A set of directions consists of several instructions. The first instruction is of the form "Begin on XXX", indicating the street that the route begins on. Each subsequent instruction is of the form "Left on XXX" or "Right on XXX", indicating a turn onto the specified road.
When reversing directions, all left turns become right turns and vice versa, and the order of roads and turns is reversed. See the sample input for examples.

-----Input-----
Input will begin with an integer T, the number of test cases that follow. Each test case begins with an integer N, the number of instructions in the route. N lines follow, each with exactly one instruction in the format described above.

-----Output-----
For each test case, print the directions of the reversed route, one instruction per line. Print a blank line after each test case.

-----Constraints-----
- 1 ≤ T ≤ 15
- 2 ≤ N ≤ 40
- Each line in the input will contain at most 50 characters, will contain only alphanumeric characters and spaces and will not contain consecutive spaces nor trailing spaces. By alphanumeric characters we mean digits and letters of the English alphabet (lowercase and uppercase).

-----Sample Input-----
2
4
Begin on Road A
Right on Road B
Right on Road C
Left on Road D
6
Begin on Old Madras Road
Left on Domlur Flyover
Left on 100 Feet Road
Right on Sarjapur Road
Right on Hosur Road
Right on Ganapathi Temple Road

-----Sample Output-----
Begin on Road D
Right on Road C
Left on Road B
Left on Road A

Begin on Ganapathi Temple Road
Left on Hosur Road
Left on Sarjapur Road
Left on 100 Feet Road
Right on Domlur Flyover
Right on Old Madras Road

-----Explanation-----
In the first test case, the destination lies on Road D, hence the reversed route begins on Road D. The final turn in the original route is turning left from Road C onto Road D. The reverse of this, turning right from Road D onto Road C, is the first turn in the reversed route.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '# Reverse Directions problem - Dec Cook off on Code Chef\nimport sys\n\nclass Directions:\n\t\n\tReversedDirections=[]\n\tReversedDirLines=[]\n\n\tdef __init__(self,dirLines,directions):\n\t\tself.DirLines=dirLines\n\t\tself.Directions=directions\n\t\t\ndef FormReversedDirLines(d):\n\ti=-1\n\tj=0\n\tReversedDirLines=[]\n\twhile i>=(-1*len(d.DirLines)):\n\t\tdirection=d.ReversedDirections[j]\n\t\tt=\' \'.join(d.DirLines[i].split()[1:])\n\t\tReversedDirLines.append(direction+\' \'+t)\n\t\ti=i-1\n\t\tj=j+1\n\treturn ReversedDirLines\n\n\ndef CorrectDirections(directions):\n\tcorrectedDirs=[directions[0]]\n\tfor d in directions[1:]:\n\t\tif d=="Right":\n\t\t\tcorrectedDirs.append("Left")\n\t\telse:\n\t\t\tcorrectedDirs.append("Right")\n\treturn correctedDirs\n\ndef Reverse(l):\n\tnewL=[]\n\ti=-1\n\twhile i>=(-1*len(l)):\n\t\tnewL.append(l[i])\n\t\ti=i-1\n\treturn newL\n\ndef RightCircularShift(l):\n\tnewL=l[1:]\n\tnewL.append(l[0])\n\treturn newL\n\n\ndef ReverseDirections(Directions):\n\trShiftDirs=RightCircularShift(Directions)\n\treverse=Reverse(rShiftDirs)\n\treverse=CorrectDirections(reverse)\n\treturn reverse\n\ndef WriteOutput(fPath,output):\n\tf=open(fPath,"w")\n\tfor d in output:\n\t\tf.writelines(d.ReversedDirLines)\n\t\tf.write(\'\\n\')\n\tf.close()\n\ndef WriteOutputToConsole(output):\n\tfor d in output:\n\t\tfor l in d.ReversedDirLines:\n\t\t\tprint(l)\n\t\tprint(\'\')\n\ndef GetDirectionsFromLines(lines):\n\tdirections=[]\n\tfor l in lines:\n\t\tdirections.append(l.split()[0])\n\treturn directions\n\ndef ReadInputFromConsole():\n\tlines=[]\n\tk=input()\n\twhile k!=\'\':\n\t\tlines.append(k)\n\t\tk=input()\n\treturn ParseInput(lines)\n\ndef ParseInput(lines):\n\tnCases=int(lines[0])\n\tparsedLines=[]\n\tprev=0\n\ti=0\n\twhile i<nCases:\n\t\tnumLineIndex=prev+1\n\t\tnDirLines=int(lines[numLineIndex])\n\t\tparsedLines.append(lines[numLineIndex+1:numLineIndex+1+nDirLines])\n\t\ti=i+1\n\t\tprev=prev+1+nDirLines\n\tinputDirs=[]\n\tfor p in parsedLines:\n\t\tdirLines=p\n\t\tdirections=GetDirectionsFromLines(p)\n\t\tinputDirs.append(Directions(dirLines,directions))\n\treturn inputDirs\n\ndef ReadInput(fPath):\n\tf=open(fPath,"r")\n\tlines=f.readlines()\n\tf.close()\n\treturn ParseInput(lines)\t\t\n\ndef __starting_point():\n\t# TestCases\n\t#print ReverseDirections(["Begin", "Right", "Right", "Left"])\n\t#print ReverseDirections(["Begin","Left","Left","Right","Right","Right"])\n\tdirections=ParseInput(sys.stdin.readlines())\n\tfor d in directions:\n\t\td.ReversedDirections=ReverseDirections(d.Directions)\n\t\td.ReversedDirLines=FormReversedDirLines(d)\n\n\tWriteOutputToConsole(directions)\n\t\n\n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 19303