solved the clasical euclid problem