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 INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7;
template <typename S, typename T>
inline bool Min(S &a, const T &b) {
  return a > b ? a = b, true : false;
}
template <typename S, typename T>
inline bool Max(S &a, const T &b) {
  return a < b ? a = b, true : false;
}
template <typename S, typename T>
inline void Adm(S &a, const T &b) {
  a = (a + b) % MOD;
  if (a < 0) a += MOD;
}
template <typename S, typename T>
inline void Mum(S &a, const T &b) {
  a = 1LL * a * b % MOD;
}
template <typename T>
inline bool IsPri(T x) {
  if (x < 2) return false;
  for (T i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return true;
}
template <typename T>
inline T Gcd(T a, T b) {
  while (b) {
    T t = b;
    b = a % b;
    a = t;
  }
  return a;
}
template <typename T>
inline int BitCnt(T x) {
  int cnt = 0;
  while (x) ++cnt, x &= x - 1;
  return cnt;
}
template <typename T>
inline T MDis(T x1, T y1, T x2, T y2) {
  return abs(x1 - x2) + abs(y1 - y2);
}
template <typename T>
inline T MDis(T x1, T y1, T z1, T x2, T y2, T z2) {
  return abs(x1 - x2) + abs(y1 - y2) + abs(z1 - z2);
}
inline double EDis(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
inline double EDis(double x1, double y1, double z1, double x2, double y2,
                   double z2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) +
              (z1 - z2) * (z1 - z2));
}
inline long long Pow(long long a, long long n) {
  long long t = 1;
  a %= MOD;
  while (n) {
    if (n & 1) t = t * a % MOD;
    a = a * a % MOD, n >>= 1;
  }
  return t % MOD;
}
inline int read() {
  static char buf[1000000], *p1 = buf, *p2 = buf;
  register int x = false;
  register char ch =
      p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
          ? EOF
          : *p1++;
  ;
  register bool sgn = false;
  while (ch != '-' && (ch < '0' || ch > '9'))
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  if (ch == '-')
    sgn = true,
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  while (ch >= '0' && ch <= '9')
    x = (x << 1) + (x << 3) + (ch ^ 48),
    ch = p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin), p1 == p2)
             ? EOF
             : *p1++;
  ;
  return sgn ? -x : x;
}
const int N = 100;
int g[N][N], d[N];
int n, m;
struct edge {
  int v, w, c, nxt, win;
} e[500100];
int h[N * N], idx;
inline void AddEdge(int u, int v, int w, int c, int win = -1) {
  e[idx] = {v, w, c, h[u], win};
  h[u] = idx++;
  e[idx] = {u, -w, 0, h[v], win};
  h[v] = idx++;
}
int dis[N * N], pre[N * N];
bool vis[N * N];
bool SPFA(int st, int ed) {
  queue<int> q;
  memset((dis), (0x3f), sizeof(dis));
  memset((pre), (-1), sizeof(pre));
  dis[st] = 0, q.push(st), vis[st] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop(), vis[u] = 0;
    for (int i = h[u]; ~i; i = e[i].nxt) {
      int v = e[i].v, w = e[i].w, c = e[i].c;
      if (dis[v] > dis[u] + w && c) {
        dis[v] = dis[u] + w;
        pre[v] = i;
        if (!vis[v]) q.push(v), vis[v] = 1;
      }
    }
  }
  return pre[ed] != -1;
}
int MCMF(int st, int ed) {
  int flow = 0;
  while (SPFA(st, ed)) {
    int mi = INF;
    for (int i = pre[ed]; ~i; i = pre[e[i ^ 1].v]) mi = min(mi, e[i].c);
    flow += mi;
    for (int i = pre[ed]; ~i; i = pre[e[i ^ 1].v])
      e[i].c -= mi, e[i ^ 1].c += mi;
  }
  return flow;
}
inline int id(int a, int b) { return min(a, b) * n + max(a, b); }
int main() {
  memset((h), (-1), sizeof(h));
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u][v] = 1, ++d[u];
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = d[i] + 1; j < n; ++j)
      AddEdge(0, i, j * j - (j - 1) * (j - 1), 1);
    for (int j = 1; j <= n; ++j)
      if (i != j && !g[i][j] && !g[j][i]) AddEdge(i, id(i, j), 0, 1, j);
  }
  for (int i = n + 1; i <= n * n + n; ++i) AddEdge(i, n * n + n + 1, 0, 1);
  int flow = MCMF(0, n * n + n + 1);
  for (int i = 1; i <= n; ++i)
    for (int j = h[i]; ~j; j = e[j].nxt)
      if (e[j].win != -1 && e[j].c == 0) g[i][e[j].win] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) putchar('0' + g[i][j]);
    putchar('\n');
  }
  return 0;
}