a fast solution to the neig