#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:500000000")
using namespace std;
int A[111];
int main() {
  int n, i, j, a;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    int v = 0;
    for (j = 0; j < n; j++) {
      scanf("%d", &a);
      if (i != j) v |= a;
    }
    A[i] = v;
  }
  printf("%d", A[0]);
  for (int i = 1; i < n; i++) printf(" %d", A[i]);
  puts("");
}
