#include <bits/stdc++.h>
time_t st = clock();
using namespace std;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long p[200][100];
long long n, r, two;
long long k[200][200];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> k[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++)
      if (i != j) {
        for (int l = 0; l < 40; l++) {
          if (p[i][l] == 0) p[i][l] = k[i][j] % 2;
          k[i][j] /= 2;
        }
      }
  }
  for (int i = 0; i < n; i++) {
    two = 1;
    r = 0;
    for (int l = 0; l < 40; l++) {
      r += p[i][l] * two;
      two *= 2;
    }
    cout << r << ' ';
  }
  return 0;
}
