#include <bits/stdc++.h>   using namespace std;   const int MOD = 1e6 + 3;   const int INFI = 1e9 * 2;   const long long LINFI = 1e17;   const double pi = acos(-1.0);   const int N = 111;   const int M = 222222;   const int move[8][2] = {1, 0, -1, 0, 0, 1, 0, -1, 1, 1, 1, -1, -1, 1, -1, -1};   int a[N][N];   int main() {     int n, m;     while (scanf( %d , &n) != EOF) {       for (int i = 0; i < n; i++)         for (int j = 0; j < n; j++) scanf( %d , &a[i][j]);       if (n == 1)         printf( %d n , 0);       else {         for (int i = 0; i < n; i++) {           m = 0;           for (int j = 0; j < n; j++)             if (i != j) m |= a[i][j];           printf( %d  , m);         }         printf(  n );       }     }     return 0;   }   