input: from typing import List, Tuple
  
  def find_connectable_server_pairs(edges: List[Tuple[int, int, int]], signalSpeed: int) -> List[int]:
      """
      Given an undirected weighted tree with n nodes representing servers labeled from 0 to n - 1, and an array edges where edges[i] = [a_i, b_i, weight_i] represents a bidirectional link between nodes a_i and b_i with weight weight_i, and an integer signalSpeed.
  
      Two servers a and b can be connected via a server c if:
  
      a < b, a ≠ c, and b ≠ c.
      The distance from c to a is a multiple of signalSpeed.
      The distance from c to b is a multiple of signalSpeed.
      The paths from c to b and c to a are edge-disjoint.
      Return an integer array count of size n where count[i] represents the number of server pairs that can be connected via the server i.
  
      Examples:
      >>> edges = [[0,1,1],[1,2,5],[2,3,13],[3,4,9],[4,5,2]], signalSpeed = 1
      [0,4,6,6,4,0]
      >>> edges = [[0,6,3],[6,5,3],[0,3,1],[3,2,7],[3,1,6],[3,4,2]], signalSpeed = 3
      [2,0,0,0,0,0,2]
  
      Constraints:
      2 <= n <= 1000
      edges.length == n - 1
      edges[i].length == 3
      0 <= a_i, b_i < n
      edges[i] = [a_i, b_i, weight_i]
      1 <= weight_i <= 10^6
      1 <= signalSpeed <= 10^6
      The input guarantees that edges form a valid tree.
      """
output:     from collections import defaultdict, deque
      def bfs(node: int) -> List[int]:
          distances = [-1] * n
          queue = deque([(node, 0)])
          distances[node] = 0
          while queue:
              current, dist = queue.popleft()
              for neighbor, weight in graph[current]:
                  if distances[neighbor] == -1:
                      distances[neighbor] = dist + weight
                      queue.append((neighbor, dist + weight))
          return distances
  
      n = len(edges) + 1
      graph = defaultdict(list)
      for u, v, w in edges:
          graph[u].append((v, w))
          graph[v].append((u, w))
  
      distances = []
      for i in range(n):
          distances.append(bfs(i))
  
      result = [0] * n
      for c in range(n):
          for a in range(n):
              for b in range(a + 1, n):
                  if a != c and b != c:
                      if distances[c][a] % signalSpeed == 0 and distances[c][b] % signalSpeed == 0:
                          pathCA = distances[c][a]
                          pathCB = distances[c][b]
                          overlap = False
                          for other in range(n):
                              if other != c:
                                  if distances[c][other] == pathCA and distances[other][b] == pathCB:
                                      overlap = True
                                      break
                          if not overlap:
                              result[c] += 1
      return result