text: // Optimise
  #include <bits/stdc++.h>
  using namespace std;
  
  #ifdef LOCAL
  #include "/home/shahraaz/bin/debug.h"
  #else
  #define db(...)
  #endif
  
  using ll = long long;
  #define f first
  #define s second
  #define pb push_back
  #define all(v) v.begin(), v.end()
  
  const int NAX = 2e5 + 5, MOD = 1000000007;
  
  void solveCase()
  {
      int n;
      cin >> n;
      vector<string> vecc(n);
      for (auto &x : vecc)
      {
          cin >> x;
      }
      vector<vector<int>> adj(n, vector<int>(n));
      for (int i = n - 1; i >= 0; i--)
      {
          for (int j = i + 1; j < n; j++)
          {
              int res = 0;
              for (int k = i + 1; k < j; k++)
              {
                  if (adj[i][k])
                      res += vecc[k][j] - '0';
                  res %= 10;
              }
              db(i, j, res, vecc[i][j]);
              if (res != (vecc[i][j] - '0'))
                  adj[i][j] = 1;
          }
      }
      for (size_t i = 0; i < n; i++)
      {
          for (size_t j = 0; j < n; j++)
          {
              cout << adj[i][j];
          }
          cout << '\n';
      }
  }
  
  int32_t main()
  {
  #ifndef LOCAL
      ios_base::sync_with_stdio(0);
      cin.tie(0);
  #endif
      int t = 1;
      // cin >> t;
      for (int i = 1; i <= t; ++i)
      {
          solveCase();
  #ifdef LOCAL
          cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
          TimeStart = chrono::steady_clock::now();
  #endif
      }
      return 0;
  }
  