initial working brute force(without projecting mask)