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