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;
const int maxn = 3e5 + 5;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
struct Dinic {
  struct Edge {
    int v, rev, cap, cot;
  };
  vector<Edge> G[maxn];
  int dis[maxn], cur[maxn], vis[maxn], n, sp, tp;
  void init(int nn) {
    n = nn;
    for (int i = 1; i <= n; ++i) G[i].clear();
  }
  void add(int u, int v, int cap, int cot) {
    G[u].push_back({v, ((int)G[v].size()), cap, cot});
    G[v].push_back({u, ((int)G[u].size()) - 1, 0, -cot});
  }
  int bfs() {
    queue<int> q;
    for (int i = 1; i <= n; ++i) dis[i] = inf, vis[i] = 0;
    dis[sp] = 0, q.push(sp), vis[sp] = 1;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      vis[u] = 0;
      for (auto &e : G[u]) {
        if (e.cap && dis[e.v] > dis[u] + e.cot) {
          dis[e.v] = dis[u] + e.cot;
          if (!vis[e.v]) q.push(e.v), vis[e.v] = 1;
        }
      }
    }
    return dis[tp] != inf;
  }
  int dfs(int u, int flow) {
    if (u == tp || !flow) return flow;
    int ret = 0, tmp;
    vis[u] = 1;
    for (int &i = cur[u]; i < ((int)G[u].size()); ++i) {
      auto &e = G[u][i];
      if (!vis[e.v] && dis[e.v] == dis[u] + e.cot &&
          (tmp = dfs(e.v, min(e.cap, flow - ret)))) {
        ret += tmp, e.cap -= tmp, G[e.v][e.rev].cap += tmp;
        if (ret == flow) {
          vis[u] = 0;
          return ret;
        }
      }
    }
    if (!ret) vis[u] = 1;
    return ret;
  }
  pair<int, int> solve(int s, int t) {
    sp = s, tp = t;
    int mf = 0, mc = 0;
    while (bfs()) {
      for (int i = 1; i <= n; ++i) cur[i] = 0;
      int tmp = dfs(sp, inf);
      mf += tmp, mc += tmp * dis[tp];
    }
    return {mf, mc};
  }
} dinic;
int id[55][55], G[55][55], in[55];
int n, m;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  memset(G, -1, sizeof G);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    ++in[v];
    G[u][v] = 1, G[v][u] = 0;
  }
  int S = n * (n - 1) + n + 1, T = S + 1;
  dinic.init(T);
  int tot = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j < i; ++j) {
      id[i][j] = ++tot;
      if (G[i][j] != -1) continue;
      dinic.add(S, id[i][j], 1, 0);
      dinic.add(id[i][j], n * (n - 1) + i, 1, 0);
      dinic.add(id[i][j], n * (n - 1) + j, 1, 0);
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = in[i]; j < n - 1; ++j) {
      dinic.add(n * (n - 1) + i, T, 1, j);
    }
  }
  dinic.solve(S, T);
  for (int i = 1; i <= tot; ++i) {
    if (!((int)dinic.G[i].size())) continue;
    auto &e1 = dinic.G[i][1];
    auto &e2 = dinic.G[i][2];
    int v1 = e1.v - n * (n - 1);
    int v2 = e2.v - n * (n - 1);
    G[v1][v2] = e1.cap;
    G[v2][v1] = G[v1][v2] ^ 1;
  }
  for (int i = 1; i <= n; ++i) G[i][i] = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) cout << G[i][j];
    cout << "\n";
  }
  return 0;
}