What eventually became a part of the grand duchy of lithuania