#include <bits/stdc++.h>
using namespace std;
int arr[200][200];
int main() {
  int n;
  cin >> n;
  vector<int> ans(n);
  for (int i = 0; i < n; i++)
    for (int l = 0; l < n; l++) cin >> arr[i][l];
  for (int i = 0; i < n; i++) {
    for (int l = 0; l < n; l++) {
      if (arr[i][l] != -1) {
        for (int k = 0; k < 32; k++) {
          ans[i] |= ((1 << k) & arr[i][l]);
        }
      }
    }
  }
  for (int i = 0; i < n; i++) cout << ans[i] << " ";
  cout << endl;
}
