input: 
  class MatrixOperations:
      """Class to perform various matrix operations like addition, subtraction, 
      multiplication and transpose.
      Example:
      >>> mat1 = MatrixOperations(2, 2, [1, 2, 3, 4])
      >>> mat2 = MatrixOperations(2, 2, [5, 6, 7, 8])
      >>> mat1.add(mat2)
      >>> print(mat1)
      6 8 
      10 12 
  
      >>> mat1 = MatrixOperations(2, 2, [1, 2, 3, 4])
      >>> mat2 = MatrixOperations(2, 2, [5, 6, 7, 8])
      >>> mat1.sub(mat2)
      >>> print(mat1)
      -4 -4 
      -4 -4 
  
      >>> mat1 = MatrixOperations(2, 2, [1, 2, 3, 4])
      >>> mat2 = MatrixOperations(2, 1, [10, 20])
      >>> mat1.mul(mat2)
      >>> print(mat1)
      50 
      110 
  
      >>> mat1 = MatrixOperations(2, 2, [1, 2, 3, 4])
      >>> mat1.transpose()
      >>> print(mat1)
      1 3 
      2 4 
      """
      def __init__(self, m, n, lst):
          self.m = m
          self.n = n
          self.mat = []
          
          c = 0
          for i in range(self.m):
              a = []
              for j in range(self.n):
                  a.append(lst[c])
                  c += 1
              self.mat.append(a)
      
      def __str__(self):
          output = ""
          for i in self.mat:
              for j in i:
                  output += str(j) + " "
              output += '\n'
          return output
      
      def add(self, mat2):
          for i in range(self.m):
              for j in range(self.n):
                  self.mat[i][j] += mat2.mat[i][j]
      
      def sub(self, mat2):
          for i in range(self.m):
              for j in range(self.n):
                  self.mat[i][j] -= mat2.mat[i][j]
      
      def mul(self, mat2):
          result = []
          for i in range(self.m):
              a = []
              for j in range(mat2.n):
                  s = 0
                  for k in range(self.n):
                      s += self.mat[i][k] * mat2.mat[k][j]
                  a.append(s)
              result.append(a)
          self.mat = result
          self.m = len(result)
          self.n = len(result[0])
      
      def transpose(self):
          result = [[self.mat[j][i] for j in range(len(self.mat))] for i in range(len(self.mat[0]))]
          self.mat = result
          self.m = len(result)
          self.n = len(result[0])
  
output:     
      def __add__(self, mat2):
          result = MatrixOperations(self.m, self.n, [0]*self.m*self.n)
          for i in range(self.m):
              for j in range(self.n):
                  result.mat[i][j] = self.mat[i][j] + mat2.mat[i][j]
          return result
      
      def __sub__(self, mat2):
          result = MatrixOperations(self.m, self.n, [0]*self.m*self.n)
          for i in range(self.m):
              for j in range(self.n):
                  result.mat[i][j] = self.mat[i][j] - mat2.mat[i][j]
          return result
      
      def __mul__(self, mat2):
          result = MatrixOperations(self.m, mat2.n, [0]*self.m*mat2.n)
          for i in range(self.m):
              for j in range(mat2.n):
                  for k in range(self.n):
                      result.mat[i][j] += self.mat[i][k] * mat2.mat[k][j]
          return result
      
      def __eq__(self, mat2):
          if self.m != mat2.m or self.n != mat2.n:
              return False
          for i in range(self.m):
              for j in range(self.n):
                  if self.mat[i][j] != mat2.mat[i][j]:
                      return False
          return True
  