#include <bits/stdc++.h>
using namespace std;
int n, res;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    res = 0;
    for (int j = 1; j <= n; j++) {
      int g;
      scanf("%d", &g);
      if (g != -1) res |= g;
    }
    printf("%d ", res);
  }
  return 0;
}
