#include <bits/stdc++.h>
using namespace std;
long long n, i, j, a, k;
bitset<100> A[110], B;
int main() {
  scanf("%lld", &n);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++) {
      scanf("%d", &a);
      if (i == j) continue;
      B = a;
      for (k = 0; k <= 100; k++) {
        if (B[k]) A[i][k] = A[j][k] = 1;
      }
    }
  for (i = 1; i <= n; i++) cout << A[i].to_ulong() << " ";
  return 0;
}
