#include <bits/stdc++.h>
using namespace std;
int n, a[200000], x;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      cin >> x;
      if (x != -1) a[i] = a[i] | x;
    }
  for (int i = 0; i < n; i++) cout << a[i] << " ";
}
