In what republic did the szlachta lose their legal privileges.