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