#include <bits/stdc++.h>
using namespace std;
const int N = 101;
int n, a[N][30];
long long nd[N][N], num[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) cin >> nd[i][j];
  memset(a, 0, sizeof(a));
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      int run = 29;
      while (run >= 0) {
        if (nd[i][j] & (1 << (29 - run))) a[i][run] = a[j][run] = 1;
        --run;
      }
    }
  for (int i = 1; i <= n; ++i)
    for (int k = 0; k <= 29; ++k) num[i] += (1 << k) * (a[i][29 - k]);
  for (int i = 1; i <= n; ++i) cout << num[i] << " ";
  cout << "\n";
}
