#include <iostream>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <bitset>
#include <time.h>
using namespace std;
typedef vector <int> vi;
#define ll long long
#define pb push_back
#define ld double
#define pld pair <ld, ld>
#define pll pair <ll, ll>
#define fi first
#define pii pair <int, int>
#define se second
#define mp make_pair
pii a[1000];
int ans[1000][1000];
int main()
{
//freopen("subsequences.in", "r", stdin);
//freopen("subsequences.out", "w", stdout);
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i].fi;
a[i].se = i;
}
for (int i = 0; i < n; i++)
{
sort(a + i, a + n);
int j = 0;
for (j = i + 1; (j < n) && a[i].fi > 0; j++)
a[i].fi--,
a[j].fi--,
ans[a[i].se][a[j].se] = 1,
ans[a[j].se][a[i].se] = 1;
for (; j < n; j++)
a[j].fi -= 2,
ans[a[i].se][a[j].se] = 0,
ans[a[j].se][a[i].se] = 2;
}
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cout << ans[i][j] << " ";
}
cout << endl;
}
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8bWF0aC5oPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nLmg+CiNpbmNsdWRlIDxzZXQ+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxiaXRzZXQ+CiNpbmNsdWRlIDx0aW1lLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgp0eXBlZGVmIHZlY3RvciA8aW50PiB2aTsKCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgcGIgcHVzaF9iYWNrCiNkZWZpbmUgbGQgZG91YmxlCiNkZWZpbmUgcGxkIHBhaXIgPGxkLCBsZD4KI2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