public static boolean isConsistent(int[] result, int N) {
         for (int i=0; i<N; i++) {
             if(result[N] == result[i]) return false;
             if(result[N] - result[i] == N - i) return false;
             if(result[N] - result[i] == i - N) return false;
         }
         return true;
     }