input: Write a python function that given a list of integers representing node values in a tree, an integer k, and a list of edges representing connections between nodes, returns the maximum sum of node values possible by repeatedly performing a specified operation on any edge. The operation involves XOR-ing the node values connected by that edge with k.
output: def max_tree_xor_sum(node_values, k, edges):
      def dfs(node, parent):
          current_val = node_values[node]
          for neighbor in tree[node]:
              if neighbor != parent:
                  possible_vals = dfs(neighbor, node)
                  for possible_val in possible_vals:
                      possible_sums.append(current_val ^ possible_val ^ k)
          return node_values[node], current_val ^ k
  
      n = len(node_values)
      tree = [[] for _ in range(n)]
      for u, v in edges:
          tree[u].append(v)
          tree[v].append(u)
  
      possible_sums = []
      dfs(0, -1)
      return max(sum(val for i, val in enumerate(node_values) if mask & (1 << i)) for mask in range(1 << n)), max(possible_sums)