input: Write a function to build a Huffman tree from given frequency and data lists.
  assert huffman_tree([5, 9, 12, 13, 16, 45], ['a', 'b', 'c', 'd', 'e', 'f']).data == '$'
  assert huffman_tree([2, 3, 7, 11], ['x', 'y', 'z', 'w']).data == '$'
  assert huffman_tree([1], ['k']).data == 'k'
output: def huffman_tree(frequencies, data):
      import heapq
      from collections import namedtuple
      
      class Node(namedtuple("Node", ["freq", "data", "left", "right"])):
          def __lt__(self, other):
              return self.freq < other.freq
      
      heap = [Node(frequencies[i], data[i], None, None) for i in range(len(data))]
      heapq.heapify(heap)
      
      while len(heap) > 1:
          left = heapq.heappop(heap)
          right = heapq.heappop(heap)
          merged = Node(left.freq + right.freq, '$', left, right)
          heapq.heappush(heap, merged)
      
      return heap[0]