During the Polish–Lithuanian–Teutonic War in 1409 the city was briefly captured by the Teutonic Knights. In the mid-15th century, during the Thirteen Years' War, King Casimir IV of Poland often stayed in Bydgoszcz. At that time, the defensive walls were built and the Gothic parish church (the present-day Bydgoszcz Cathedral). The city was developing dynamically thanks to river trade. Bydgoszcz pottery and beer were popular throughout Poland. In the 15th and 16th centuries, Bydgoszcz was a significant site for wheat trading, one of the largest in Poland. The first mention of a school in Bydgoszcz comes from 1466.