input: Write a python function to create a tree from given tuples.
  assert createTree([('a', 'b'), ('a', 'c'), ('b', 'd'), ('b', 'e'), ('c', 'f')]).data == 'a'
  assert len(createTree([('a', 'b'), ('a', 'c'), ('b', 'd'), ('b', 'e'), ('c', 'f')]).children) == 2
  assert createTree([('a', 'b'), ('a', 'c'), ('b', 'd'), ('b', 'e'), ('c', 'f')]).children[0].data == 'b'
output: class TreeNode:
      def __init__(self, data):
          self.data = data
          self.children = []
  
  def createTree(tuples):
      nodes = {}
      
      # Create or get a node
      def getNode(data):
          if data not in nodes:
              nodes[data] = TreeNode(data)
          return nodes[data]
      
      root = None
      for parent, child in tuples:
          parentNode = getNode(parent)
          childNode = getNode(child)
          parentNode.children.append(childNode)
          
          if root is None or root.data == child:
              root = parentNode
              
      return root