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;
struct Edge {
  int from, to, capacity, cost, compete;
};
vector<vector<int>> adj, cost, capacity;
const int INF = 1e9;
void shortest_paths(int n, int v0, vector<int>& d, vector<int>& p) {
  d.assign(n, INF);
  d[v0] = 0;
  vector<bool> inq(n, false);
  queue<int> q;
  q.push(v0);
  p.assign(n, -1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    inq[u] = false;
    for (int v : adj[u]) {
      if (capacity[u][v] > 0 && d[v] > d[u] + cost[u][v]) {
        d[v] = d[u] + cost[u][v];
        p[v] = u;
        if (!inq[v]) {
          inq[v] = true;
          q.push(v);
        }
      }
    }
  }
}
int min_cost_flow(int N, vector<Edge> edges, int K, int s, int t) {
  adj.assign(N, vector<int>());
  cost.assign(N, vector<int>(N, 0));
  capacity.assign(N, vector<int>(N, 0));
  for (Edge e : edges) {
    adj[e.from].push_back(e.to);
    adj[e.to].push_back(e.from);
    cost[e.from][e.to] = e.cost;
    cost[e.to][e.from] = -e.cost;
    capacity[e.from][e.to] = e.capacity;
  }
  int flow = 0;
  int cost = 0;
  vector<int> d, p;
  while (flow < K) {
    shortest_paths(N, s, d, p);
    if (d[t] == INF) break;
    int f = K - flow;
    int cur = t;
    while (cur != s) {
      f = min(f, capacity[p[cur]][cur]);
      cur = p[cur];
    }
    flow += f;
    cost += f * d[t];
    cur = t;
    while (cur != s) {
      capacity[p[cur]][cur] -= f;
      capacity[cur][p[cur]] += f;
      cur = p[cur];
    }
  }
  if (flow < K)
    return -1;
  else
    return cost;
}
int main() {
  int nw[55], w[55];
  int g[55][55];
  int s = 0, t = 3002;
  char ch[55][55];
  int n, m;
  cin >> n >> m;
  vector<Edge> edges;
  memset(w, 0, sizeof(w));
  memset(nw, 0, sizeof(nw));
  memset(g, 0, sizeof(g));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) ch[i][j] = '0';
  }
  int u, v;
  for (int i = 1; i <= m; i++) {
    cin >> u >> v;
    w[u]++;
    g[u][v] = 1;
    ch[u][v] = '1', ch[v][u] = '0';
    g[v][u] = 1;
  }
  int mnode = n + 1;
  int K = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (j != i && g[j][i] == 0 && g[i][j] == 0) {
        Edge ed, ed2, ed3;
        ed.from = s, ed.to = mnode, ed.cost = 0, ed.capacity = 1,
        ed.compete = -1;
        edges.push_back(ed);
        ed2.from = mnode, ed2.to = i, ed2.cost = 0, ed2.capacity = 1,
        ed2.compete = j;
        ed3.from = mnode, ed3.to = j, ed3.cost = 0, ed3.capacity = 1,
        ed3.compete = i;
        edges.push_back(ed2), edges.push_back(ed3);
        nw[i]++, nw[j]++;
        g[j][i] = 1;
        g[i][j] = 1;
        mnode++;
        K++;
      }
    }
  }
  int cnt = mnode;
  for (int i = 1; i <= n; i++) {
    cnt += nw[i];
  }
  t = cnt;
  for (int i = 1; i <= n; i++) {
    int val = 1;
    for (int j = 1; j <= nw[i]; j++) {
      Edge ed;
      ed.from = i, ed.to = mnode, ed.capacity = 1, ed.cost = 2 * w[i] + val,
      ed.compete = -1;
      Edge ed2;
      ed2.from = mnode, ed2.to = t, ed2.capacity = 1, ed2.cost = 0,
      ed2.compete = -1;
      edges.push_back(ed);
      edges.push_back(ed2);
      mnode++;
      val = val + 2;
    }
  }
  int sum = min_cost_flow(t + 5, edges, K, s, t);
  for (auto ed : edges) {
    int x = ed.from, y = ed.to, z = ed.compete;
    if (y >= 1 && y <= n && z >= 1 && z <= n) {
      if (capacity[x][y] == 0)
        ch[y][z] = '1';
      else
        ch[y][z] = '0';
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) cout << ch[i][j];
    cout << endl;
  }
  return 0;
}