import java.util.*;
public class AddTwoMatrix{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter no of row of matrix");
int m = sc.nextInt();
System.out.println("Enter no of column of matrix");
int n = sc.nextInt();
int my_arr1[][] = new int[m][n];
int my_arr2[][] = new int[m][n];
int sum[][]=new int[m][n];
System.out.println("Enter the first matrix");
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
my_arr1[i][j]=sc.nextInt();
}
}
System.out.println("Enter the Second matrix");
for(int i=0;i<m;i++){
for(int j=0;j<m;j++){
my_arr2[i][j]=sc.nextInt();
}
}
//Sum of matrix
for(int i=0;i<my_arr1.length;i++){
for(int j=0;j<my_arr2.length;j++){
sum[i][j]=my_arr1[i][j]+my_arr2[i][j];
}
}
System.out.println("The sum of the matrix is :");
for(int i=0;i<sum.length;i++){
for(int j=0;j<sum.length;j++){
System.out.print(sum[i][j]+" ");
}
System.out.println();
}
}
}