#include <bits/stdc++.h>   using namespace std;   void dk_98() {}   long long gcd(long long a, long long b) {     if (b == 0) return a;     return gcd(b, a % b);   }   void solve() {     int n;     cin >> n;     int arr[n][n];     for (long long i = 0; i < (int)(n); i++) {       for (long long j = 0; j < (int)(n); j++) {         cin >> arr[i][j];       }     }     if (n == 1) {       cout << 0;       return;     }     int ans[n];     memset(ans, 0, sizeof(ans));     for (int i = 0; i < n; i++) {       for (int j = 0; j < n; j++) {         if (j != i) ans[i] = ans[i] | arr[i][j];       }     }     for (long long i = 0; i < (int)(n); i++) {       cout << ans[i] <<    ;     }   }   int main() {     ios::sync_with_stdio(false);     cin.tie(NULL);     cout.tie(NULL);     ;     dk_98();     int t = 1;     while (t--) {       solve();     }   }   