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