In the case of Prussia, it's not going to be able to do much on its own with an enlarged Poland.
Tell Austria you lose the Polish land, but we'll support anything against Russia in the Balkans and you can keep that? They may not be a reliable ally, but they can be won over.
If Russia tries something, beat his armies then win his slice of Poland in the peace deal.
A Franco-Austrian-Polish alliance might be a bit tricky, but it would dominate Europe.
Tell Austria you lose the Polish land, but we'll support anything against Russia in the Balkans and you can keep that? They may not be a reliable ally, but they can be won over.
If Russia tries something, beat his armies then win his slice of Poland in the peace deal.
A Franco-Austrian-Polish alliance might be a bit tricky, but it would dominate Europe.