#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, x, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    ans = 0;
    for (int j = 0; j < n; j++) {
      cin >> x;
      if (x != -1) ans |= x;
    }
    cout << ans << " ";
  }
  return 0;
}
