#include <algorithm>
#include <iostream>

using namespace std;

int main(){
    double t, a, b, c, d, e, f, x, y;
    cin >> t;
    while(t--){
        cin >> a >> b >> c >> d >> e >> f;
        y = (c/(double)a - f/(double)d)/(b/(double)a - e/(double)d);
        x = (c-b*(double)y)/(double)a;
        cout << x << " " << y << endl;
    }
    return 0;
}