Form cyclic array of elements 1 to n - 1
for ( long long i = 1 ; i < n - 1 ; ++ i ) for ( long long j = 0 ; j < n - 1 ; ++ j ) initial_array [ i ] [ j ] = initial_array [ i - 1 ] [ ( j + 1 ) % ( n - 1 ) ] ;