https://foxstack.blogspot.com/2022/03/nearly-similar-rectangles-problem.html