Comments

Editorial of problem G doesn't make sense to me. Can anyone help me ? why cyclically shifted by d works?