#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define faster() ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
const int MOD = 1e9 + 7 ;
int n , m ;
int a[1005][1005];
void solve(){
cin >> n >> m ;
for(int i = 1 ; i <= m ; i++){
int x , y ; cin >> x >> y ;
a[x][y] = 1 ;
a[y][x] = 1 ;
}
for(int i = 1 ; i <= n ; i++){
for(int j = 1 ; j <= n ; j++){
cout << a[i][j] << " ";
}
cout << endl;
}
}
int main() {
faster();
int test = 1 ;
// cin >> test ;
while(test--) solve();
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZW5kbCAiXG4iCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgZmFzdGVyKCkgaW9zOjpzeW5jX3dpdGhfc3RkaW8oZmFsc2UpOyBjaW4udGllKG51bGxwdHIpOyBjb3V0LnRpZShudWxscHRyKTsKY29uc3QgaW50IE1PRCA9IDFlOSArIDcgOwoKaW50IG4gLCBtIDsgCmludCBhWzEwMDVdWzEwMDVdOwp2b2lkIHNvbHZlKCl7CiAgICBjaW4gPj4gbiA+PiBtIDsKICAgIGZvcihpbnQgaSA9IDEgOyBpIDw9IG0gOyBpKyspewogICAgICAgIGludCB4ICwgeSA7ICBjaW4gPj4geCA+PiB5IDsKICAgICAgICBhW3hdW3ldID0gMSA7CiAgICAgICAgYVt5XVt4XSA9IDEgOwogICAgfQogICAgZm9yKGludCBpID0gMSA7IGkgPD0gbiA7IGkrKyl7CiAgICAgICAgZm9yKGludCBqID0gMSA7IGogPD0gbiA7IGorKyl7CiAgICAgICAgICAgIGNvdXQgPDwgYVtpXVtqXSA8PCAiICI7CiAgICAgICAgfQogICAgICAgIGNvdXQgPDwgZW5kbDsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBmYXN0ZXIoKTsgCiAgICBpbnQgdGVzdCA9IDEgOyAKICAgIC8vIGNpbiA+PiB0ZXN0IDsKICAgIHdoaWxlKHRlc3QtLSkgICBzb2x2ZSgpOwogICAgcmV0dXJuIDA7Cn0KCgo=