Seems to work, but it's a brute force solution, so it doesn't pass