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