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