brute force solution