# Arup Guha
# 4/29/2024
# Solution to COP 4516 Team Final Contest Problem H: Red-Black Tree

from collections import deque

# Solves the problem on graph g with paint costs r and b.
def solve(g,r,b):

    # Stores # of vertices of each color.
    cnts = []
    cnts.append(0)
    cnts.append(0)
    n = len(g)

    # BFS distance array will store either 0 or 1, 0 if same parity
    # as node 0, 1 if opposite parity.
    used = []
    for i in range(n):
        used.append(-1)
    used[0] = 0

    # Set up BFS queue.
    queue = deque()
    queue.append(0)
    cnts[0] = 1

    # Run BFS.
    while len(queue) > 0:

        # Get next.
        cur = queue.popleft()

        # Go to neighbors.
        for x in g[cur]:

            # Been here before.
            if used[x] != -1:
                continue

            # We can just to 1-x to flip...then add to queue.
            used[x] = 1 - used[cur]
            queue.append(x)

    # Count how many nodes are color 0.
    num0 = 0
    for i in range(n):
        if used[i] == 0:
            num0 += 1

    # This is color 1.
    num1 = n - num0

    # Be greedy if a node occurs more, color it with the cheaper paint.
    return max(num0,num1)*min(r,b) + min(num0,num1)*max(r,b)
            

# Get # of cases.
nC = int(input())

# Process cases.
for loop in range(nC):

    # Get basic input.
    toks = input().split()
    n = int(toks[0])
    r = int(toks[1])
    b = int(toks[2])

    # Make graph.
    g = []
    for i in range(n):
        g.append([])
    for i in range(n-1):
        toks = input().split()
        u = int(toks[0])-1
        v = int(toks[1])-1
        g[u].append(v)
        g[v].append(u)

    # Go!
    print(solve(g,r,b))

    
