#include <iostream>
using namespace std;
template <class T>
T uread() {
char c = getchar();
while (c < '0' || c > '9') {
c = getchar();
}
T num = 0;
while (c >= '0' && c <= '9') {
num = (num << 1) + (num << 3) + (c ^ 48);
c = getchar();
}
return num;
}
template <class T>
T bread() {
char c = getchar();
while (c < '0' || c > '9') {
c = getchar();
}
T num = 0; int len = 0;
while (c >= '0' && c <= '9') {
num |= (c ^ 48) * (1 << len++);
c = getchar();
}
return num;
}
const int N = 24;
int reach[1 << N];
int main(int argc, const char * argv[]) {
int n = uread<int>(), all = (1 << n) - 1, graph[N];
for (int i = 0; i < n; ++i) {
graph[i] = bread<int>();
}
reach[1] = 1;
for (int state = 1; state <= all; state += 2) {
int edge = 0;
for (int i = reach[state]; i; i &= i - 1) {
edge |= graph[__builtin_ctz(i)];
}
for (int i = edge & (all ^ state); i; i &= i - 1) {
reach[state | (i & -i)] |= i & -i;
}
}
int ans[N]; memset(ans, 0, sizeof(ans));
for (int state = 1; state <= all; state += 2) {
for (int i = reach[state]; i; i &= i - 1) {
ans[__builtin_ctz(i)] |= reach[(all ^ state) | 1];
}
}
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
putchar((ans[i] >> j & 1) + '0');
}
putchar('\n');
}
return 0;
}