#include <bits/stdc++.h>
using namespace std;
int num[105];
int main() {
  int n;
  while (cin >> n) {
    int a;
    memset(num, 0, sizeof(num));
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        scanf("%d", &a);
        if (a != -1) num[i] |= a;
      }
    printf("%d", num[0]);
    for (int i = 1; i < n; i++) printf(" %d", num[i]);
    cout << endl;
  }
  return 0;
}
