#include<stdio.h>
int main(){
    int r1,c1,r2,c2;
    int A[100][100],B[100][100],C[100][100];
    scanf("%d %d",&r1,&c1);
    for(int i=0; i<r1;i++){
        for(int j=0; j<c1;j++){
            scanf("%d",&A[i][j]);
        }
    }
    scanf("%d %d %d",&r2,&c2)
    for(int i=0; i<r2; i++){
        for(int j=0; j<c2; j++){
        scanf("%d",&B[i][j]);
            }
        } 
        if(c1!=r2){
            printf("Invalid input");
            return 0;
        }
        for(int i=0; i<r1; i++){
            for(int j=0; j<c2; j++){
                C[i][j]=0;
            }
        }
        for(int i=0; i<r1; i++){
            for(int j=0; j<c2; j++){
                for(int k=0; k<c1; k++){
                    C[i][j]+=A[i][k]*B[k][j];
                }
            }
        }
        for(int i=0; i<r1; i++){
            for(int j=0; j<c2; j++){
                printf("%d ",C[i][j]);
            }
            printf("\n");
        }
        return 0;
    
}