Problem: A football league has recently begun in Beautiful land. There are n teams participating in the league. Let's enumerate them with integers from 1 to n.

There will be played exactly (n(n-1))/(2) matches: each team will play against all other teams exactly once. In each match, there is always a winner and loser and there is no draw.

After all matches are played, the organizers will count the number of beautiful triples. Let's call a triple of three teams (A, B, C) beautiful if a team A win against a team B, a team B win against a team C and a team C win against a team A. We look only to a triples of different teams and the order of teams in the triple is important.

The beauty of the league is the number of beautiful triples.

At the moment, m matches were played and their results are known.

What is the maximum beauty of the league that can be, after playing all remaining matches? Also find a possible results for all remaining (n(n-1))/(2) - m matches, so that the league has this maximum beauty.

Input

The first line contains two integers n, m (3 ≤ n ≤ 50, 0 ≤ m ≤ (n(n-1))/(2)) — the number of teams in the football league and the number of matches that were played.

Each of m following lines contains two integers u and v (1 ≤ u, v ≤ n, u ≠ v) denoting that the u-th team won against the v-th team. It is guaranteed that each unordered pair of teams appears at most once.

Output

Print n lines, each line having a string of exactly n characters. Each character must be either 0 or 1.

Let a_{ij} be the j-th number in the i-th line. For all 1 ≤ i ≤ n it should be true, that a_{ii} = 0. For all pairs of teams i ≠ j the number a_{ij} indicates the result of the match between the i-th team and the j-th team:

  * If a_{ij} is 1, the i-th team wins against the j-th team; 
  * Otherwise the j-th team wins against the i-th team; 
  * Also, it should be true, that a_{ij} + a_{ji} = 1. 



Also note that the results of the m matches that were already played cannot be changed in your league.

The beauty of the league in the output should be maximum possible. If there are multiple possible answers with maximum beauty, you can print any of them.

Examples

Input


3 1
1 2


Output


010
001
100


Input


4 2
1 2
1 3


Output


0110
0001
0100
1010

Note

The beauty of league in the first test case is equal to 3 because there exists three beautiful triples: (1, 2, 3), (2, 3, 1), (3, 1, 2).

The beauty of league in the second test is equal to 6 because there exists six beautiful triples: (1, 2, 4), (2, 4, 1), (4, 1, 2), (2, 4, 3), (4, 3, 2), (3, 2, 4).

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
long long const inf = 1e18;
struct MCMF {
  int sr, sn;
  vector<long long> d;
  vector<int> dr, ce;
  vector<vector<int> > g;
  struct ED {
    int v, cp;
    long long cs, cc;
    ED() {}
    ED(int a, int b, long long c) : v(a), cp(b), cs(c), cc(c) {}
  };
  vector<ED> ed;
  pair<int, long long> kl(int v, int cp = 1e9) {
    if (v == sn) return make_pair(cp, 0);
    int fl = 0;
    long long cs = 0;
    for (; ~ce[v]; --ce[v]) {
      int t = g[v][ce[v]];
      if (!ed[t].cp) continue;
      int u = ed[t].v;
      if (dr[v] + 1 != dr[u] || ed[t].cc) continue;
      pair<int, long long> an = kl(u, min(ed[t].cp, cp - fl));
      fl += an.first;
      cs += ed[t].cs * an.first + an.second;
      ed[t].cp -= an.first;
      ed[t ^ 1].cp += an.first;
      if (fl == cp) break;
    }
    if (fl < cp) dr[v] = 0;
    return make_pair(fl, cs);
  }
  void upd() {
    for (int i = 0; i < (int)(g.size()); ++i) {
      for (int t : g[i]) ed[t].cc += d[i] - d[ed[t].v];
      ce[i] = g[i].size() - 1;
    }
  }
  void di() {
    for (int i = 0; i < (int)(d.size()); ++i) d[i] = inf;
    d[sr] = 0;
    for (int i = 0; i < (int)(dr.size()); ++i) dr[i] = 0;
    priority_queue<pair<long long, int> > q;
    q.push(make_pair(0, sr));
    while (!q.empty()) {
      long long c = -q.top().first;
      int v = q.top().second;
      q.pop();
      if (c > d[v]) continue;
      for (int t : g[v])
        if (ed[t].cp) {
          int u = ed[t].v;
          long long nc = c + ed[t].cc;
          if (nc < d[u]) dr[u] = dr[v] + 1, q.push(make_pair(-(d[u] = nc), u));
        }
    }
    upd();
  }
  pair<int, long long> mcmf(int s, int t) {
    sr = s, sn = t;
    d = vector<long long>(g.size(), inf);
    dr = vector<int>(g.size(), 1e9);
    ce = vector<int>(g.size());
    d[sr] = dr[sr] = 0;
    for (int it = 1; it < (int)(g.size()); ++it)
      for (int i = 0; i < (int)(g.size()); ++i)
        if (d[i] != inf)
          for (int t : g[i])
            if (ed[t].cp) {
              int u = ed[t].v;
              long long nc = d[i] + ed[t].cs;
              if (nc < d[u]) d[u] = nc, dr[u] = dr[i] + 1;
            }
    upd();
    int fl = 0;
    long long cs = 0;
    while (d[sn] != inf) {
      pair<int, long long> t = kl(sr);
      fl += t.first;
      cs += t.second;
      di();
    }
    return make_pair(fl, cs);
  }
  void aded(int a, int b, int w1 = 1, int cst = 0, int w2 = 0) {
    g.resize(max((int)g.size(), max(a, b) + 1));
    g[a].push_back(ed.size());
    ed.emplace_back(b, w1, cst);
    g[b].push_back(ed.size());
    ed.emplace_back(a, w2, -cst);
  }
};
int const N = 50;
int n, ed[N][N], nd[N], m, T;
bool bad[N][N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (int)(n); ++i)
    for (int j = i + 1; j < (int)(n); ++j) ed[i][j] = ed[j][i] = T++;
  for (int i = 0; i < (int)(n); ++i) nd[i] = T++;
  int sr = T++, sn = T++;
  MCMF mf;
  for (int i = 0; i < (int)(n); ++i)
    for (int j = i + 1; j < (int)(n); ++j) mf.aded(sr, ed[i][j], 1, 0);
  for (int i = 0; i < (int)(m); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    --a, --b;
    bad[a][b] = bad[b][a] = true;
    mf.aded(ed[a][b], nd[b], 1, 0);
  }
  for (int i = 0; i < (int)(n); ++i)
    for (int j = 0; j < (int)(n); ++j)
      if (i != j && !bad[i][j]) mf.aded(ed[i][j], nd[j], 1, 0);
  for (int i = 0; i < (int)(n); ++i)
    for (int j = 1; j < (int)(n); ++j) mf.aded(nd[i], sn, 1, 4 * j - 2 * n);
  mf.mcmf(sr, sn);
  for (int i = 0; i < (int)(n); ++i) {
    for (int j = 0; j < (int)(n); ++j) {
      if (i == j)
        printf("0");
      else {
        bool ok = false;
        for (int u : mf.g[ed[i][j]])
          if (mf.ed[u].v == nd[j]) {
            printf("%c", mf.ed[u].cp ? '0' : '1');
            ok = true;
            break;
          }
        if (!ok) printf("0");
      }
    }
    printf("\n");
  }
}