#include <bits/stdc++.h>
int a[101][101];
int b[101];
int main() {
  int n;
  scanf("%d", &n);
  memset(b, 0, sizeof(b));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      scanf("%d", &a[i][j]);
      if (i != j) b[i] |= a[i][j];
    }
  }
  for (int i = 1; i < n; i++) printf("%d ", b[i]);
  printf("%d\n", b[n]);
  return 0;
}
