During the end of the Middle Ages which two kingdoms was Great Britain divided into