#include <stdio.h>

int main(){
    int V,E,r,c,itr,u,v;
    scanf("%d\n%d",&V,&E);
    int mat[V][V];
    for(r=0;r<V;r++){
        for(c=0;c<V;c++){
           mat[V][C] = 0; 
        }
    }
    for(i=0;i<V;i++){
        scanf("%d %d",&u,&v);
        mat[u][v] = 1;
    }
    
    for(r=0;r<V;r++){
        for(c=0;c<V;c++){
           printf("%d ",mat[r][c]);
        }
    }
    
}