swap p and q