# Path: ui/stack/stack.py
# def stack(self, dimension, other, spacing = 0):
#   if self._backend.stacks():
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = spacing
#     coords = list(self._coords)
#     for i in range(len(coords)):
#       if i == dimension:
#         coords[i] += spacing + other._coords[i]
#       else:
#         coords[i] = max(coords[i], other._coords[i])
#     return Stack(coords, self._backend.stack(dimension, other._backend.shift(offset)))
#   else:
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = self.widths()[dimension] + spacing
#     return self.below(other.shift(offset))


from ui.stack import stack
  m = 0
  if len(xs) > 0:
    m = len(xs[0])
  for e in range(len(xs), i):
    copy.append(blank * m)
  copy.extend(xs)
  return copy

def hextend(xs, i):
  if len(xs) > 0:
    assert(len(xs[0]) <= i)
  result = []
  for x in xs:
    result.append(x + blank * (i - len(x)))
  return result

class TextBackend(stack.Backend):
  def __init__(self, strings):
    self.strings = strings
    if len(strings) > 0:
      m = len(strings[0])
      for s in strings:
        assert(m == len(s))

  def stacks(self):
    return True

  def uses_epsilon(self):
    return False


# Path: ui/stack/stack.py
# def stack(self, dimension, other, spacing = 0):
#   if self._backend.stacks():
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = spacing
#     coords = list(self._coords)
#     for i in range(len(coords)):
#       if i == dimension:
#         coords[i] += spacing + other._coords[i]
#       else:
#         coords[i] = max(coords[i], other._coords[i])
#     return Stack(coords, self._backend.stack(dimension, other._backend.shift(offset)))
#   else:
#     offset = [0 for i in range(self.dimension())]
#     offset[dimension] = self.widths()[dimension] + spacing
#     return self.below(other.shift(offset))


# Path: ui/stack/text.py
from ui.stack import stack

  m = 0
  if len(xs) > 0:
    m = len(xs[0])
  for e in range(len(xs), i):
    copy.append(blank * m)
  copy.extend(xs)
  return copy

def hextend(xs, i):
  if len(xs) > 0:
    assert(len(xs[0]) <= i)
  result = []
  for x in xs:
    result.append(x + blank * (i - len(x)))
  return result

class TextBackend(stack.Backend):
  def __init__(self, strings):
    self.strings = strings
    if len(strings) > 0:
      m = len(strings[0])
      for s in strings:
        assert(m == len(s))

  def stacks(self):
    return True

  def uses_epsilon(self):
    return False


  def stack(self, dimension, other):