#include <bits/stdc++.h>
using namespace std;
int a[105][105];
int bit[105][105];
int main() {
  int n;
  cin >> n;
  memset(a, 0, sizeof(a));
  memset(bit, 0, sizeof(bit));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int sum = a[i][j];
      int bit1 = 63;
      while (sum) {
        int s = sum % 2;
        if (s == 1) {
          bit[i][bit1] = 1;
          bit[j][bit1] = 1;
        }
        sum /= 2;
        bit1--;
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    int aa = 0;
    for (int j = 0; j <= 63; j++) {
      if (bit[i][j] == 1) {
        aa = aa * 2 + 1;
      } else
        aa = aa * 2;
    }
    if (i == n)
      cout << aa << endl;
    else
      cout << aa << " ";
  }
  return 0;
}
