Medium

42.8%

Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Every node contains distinct data.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains an integer n denoting the number of edges of the tree. The next line contains the edges of the binary tree.

**Output:**

Print the maximum path sum in the binary tree.

**Constraints:**

1<=T<=100

1<=n<=100

-100<=data of node<=100

**Example:
Input:**

2

6

10 2 L 2 20 L 2 1 R 10 -25 R -25 3 L -25 4 R

3

10 2 L 10 5 R 5 -2 R

**Output:**

32

17