G - Maxpool

MAXPOOL Problem - CodeChef : link for problem
Can someone help me with the logic behind solving this problem? I’m a beginner to this platform and to coding. This is a problem from the easy section of practice problems , G-Maxpool. Please just tell me the logic behind it and not the code or solution. The only language I’m familiar with is Python. Thanks