In the Deluge Poland was invaded by Sweden and Russia. Sweden conquered Poland and Lithuania. Russia conquered Ukraine and Belarus. Yet the Polish carpathian held out. But Tsar Alexis felt he got short end of the stick and turned on Sweden. Poland used this to recovered their territories.
So...