RMQ (verified by POJ3264)