#include <iostream>using namespace std;int main() { int n,a,b,c,d,e,f; cin>>n; for(int i=1; i<=n; i++){ cin>>a>>b>>c>>d>>e>>f; cout<<(c*e-b*f)/(a*e-b*d)<<" "<<(c*d-a*f)/(b*d-a*e)<<endl; } return 0;}