input: Write a python function to add and multiply two matrices using the Matrix class.
  assert Matrix(2, 2, [[1, 2], [3, 4]]).add(Matrix(2, 2, [[5, 6], [7, 8]])).data == [[6, 8], [10, 12]]
  assert Matrix(2, 2, [[1, 2], [3, 4]]).mul(Matrix(2, 2, [[5, 6], [7, 8]])).data == [[19, 22], [43, 50]]
  assert Matrix(3, 3, [[1, 2, 3], [4, 5, 6], [7, 8, 9]]).add(Matrix(3, 3, [[9, 8, 7], [6, 5, 4], [3, 2, 1]])).data == [[10, 10, 10], [10, 10, 10], [10, 10, 10]]
  assert Matrix(3, 3, [[1, 2, 3], [4, 5, 6], [7, 8, 9]]).mul(Matrix(3, 3, [[9, 8, 7], [6, 5, 4], [3, 2, 1]])).data == [[30, 24, 18], [84, 69, 54], [138, 114, 90]]
output: class Matrix:
      def __init__(self, rows, cols, data):
          self.rows = rows
          self.cols = cols
          self.data = data
  
      def add(self, other):
          result = []
          for i in range(self.rows):
              row = []
              for j in range(self.cols):
                  row.append(self.data[i][j] + other.data[i][j])
              result.append(row)
          return Matrix(self.rows, self.cols, result)
  
      def mul(self, other):
          result = []
          for i in range(self.rows):
              row = []
              for j in range(other.cols):
                  sum_product = 0
                  for k in range(self.cols):
                      sum_product += self.data[i][k] * other.data[k][j]
                  row.append(sum_product)
              result.append(row)
          return Matrix(self.rows, other.cols, result)