#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
const double eps = 1e-9L;
const double pi = acos(-1.0);
int main() {
  int ans, x, n;
  cin >> n;
  for (int i = 0, _n = (n); i < _n; i++) {
    ans = 0;
    for (int j = 0, _n = (n); j < _n; j++) {
      cin >> x;
      if (i != j) ans |= x;
    }
    cout << ans << " ";
  }
  return 0;
}
