Rename lcd to gcd.
Implement dynamic RMQ