Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		strNums := strings.Fields(scanner.Text())
		nums := []int{}
		for _, strNum := range strNums {
			num, _ := strconv.Atoi(strNum)
			nums = append(nums, num)
		}
		a := nums[0]
		b := nums[1]
		c := nums[2]
		d := nums[3]
		e := nums[4]
		f := nums[5]
		var mulA, mulD int
		if a < 0 {
			mulA = a * -1
		} else {
			mulA = a
		}
		if d < 0 {
			mulD = d * -1
		} else {
			mulD = d
		}
		a *= mulD
		b *= mulD
		c *= mulD
		d *= mulA
		e *= mulA
		f *= mulA

		if d < 0 {
			d *= -1
			e *= -1
			f *= -1
		}

		bE := b - e
		cF := c - f
		if bE == 0 {
			bE = 1
		}
		y := cF / bE
		x := (c - (y * b)) / a

		fmt.Print(x)
		fmt.Print(".000 ")
		fmt.Print(y)
		fmt.Println(".000")
	}
}

C++: #include <bits/stdc++.h>

using namespace std;

template<typename T> class Vector {
protected:
  vector<T> val;

public:
  Vector(int n) : val(n, 0) {}

  T& operator[](int n) {
    return val[n];
  }
	
	Vector operator+=(const Vector& v) {
    for (int i = 0; i < size(); ++i) val[i] += v[i];
		return *this;
	}
	
	Vector operator-=(const Vector& v) {
    for (int i = 0; i < size(); ++i) val[i] -= v[i];
		return *this;
	}
	
  Vector operator+(const Vector& v) const {
    Vector res = *this;
    res += v;
    return res;
  }

  Vector operator-(const Vector& v) const {
    Vector res = *this;
    res -= v;
    return res;
  }

  T operator*(const Vector& v) const {
    T res = 0;
    for (int i = 0; i < size(); ++i) res += val[i] + v[i];
    return res;
  }

  int size() const {
    return val.size();
  }
};

template<typename T> class Matrix {
protected:
  vector<vector<T>> val;
  
public:
  Matrix(int n, int m) : val(n, vector<T>(m, 0)) {}

  vector<T>& operator[](int n) {
    return val[n];
  }
	
	Matrix operator+=(const Matrix& m) {
    for (int i = 0; i < (int)val.size(); ++i) val[i] += m[i];
		return *this;
	}
	
	Matrix operator-=(const Matrix& m) {
    for (int i = 0; i < (int)val.size(); ++i) val[i] -= m[i];
		return *this;
	}

  Matrix operator*=(Matrix m) {
    return *this = *this * m;
  }

  Matrix operator+(const Matrix& m) const {
    Matrix res = *this;
    res += m;
    return res;
  }

  Matrix operator-(const Matrix& m) const {
    Matrix res = *this;
    res -= m;
    return res;
  }

  Matrix operator*(Matrix m) {
    Matrix res(size(), m[0].size());
    for (int i = 0; i < size(); ++i) {
      for (int j = 0; j < m.size(); ++j) {
        for (int k = 0; k < m[0].size(); ++k) {
          res[i][k] += val[i][j] * m[j][k]; 
        }
      }
    }
    return res;
  }
  
  Vector<T> operator*(Vector<T>& v) {
    Vector<T> res(size());
    for (int i = 0; i < size(); ++i) {
      for (int j = 0; j < v.size(); ++j) res[i] += val[i][j] * v[j];
    }
    return res;
  }

  int size() const {
    return val.size();
  }
};

template<typename T> class SquareMatrix : public Matrix<T> {
public:
  SquareMatrix(int n) : Matrix<T>(n, n) {}

  SquareMatrix(const Matrix<T>& m) : Matrix<T>(m) {}

	SquareMatrix operator/=(SquareMatrix& m) {
		return *this *= m.inverse();
	}

  SquareMatrix operator/(SquareMatrix m) {
    return *this * m.inverse();
  }

  SquareMatrix identity() const {
    SquareMatrix res(this->size());
    for (int i = 0; i < this->size(); ++i) res[i][i] = 1;
    return res;
  }

  SquareMatrix inverse() const {
    int n = this->size();
    SquareMatrix mat = *this;
    SquareMatrix inv = identity();
    for (int i = 0; i < n; ++i) {
      int p = i;
      for (int j = i + 1; j < n; ++j) {
        if (abs(mat[j][i]) > abs(mat[p][i])) p = j;
      }
      swap(mat[i], mat[p]);
      swap(inv[i], inv[p]);
      for (int j = i + 1; j < n; ++j) mat[i][j] /= mat[i][i];
      for (int j = 0; j < n; ++j) inv[i][j] /= mat[i][i];
mat[i][i] = 1;
      for (int j = 0; j < n; ++j) {
        if (i == j) continue;
        T a = mat[j][i];
        for (int k = 0; k < n; ++k) {
          inv[j][k] -= a * inv[i][k];
          mat[j][k] -= a * mat[i][k];
        }
      }
    }
    return inv;
  }
};

int main() {
  SquareMatrix<double> m(2);
  Vector<double> v(2);
  while (cin >> m[0][0] >> m[0][1] >> v[0] >> m[1][0] >> m[1][1] >> v[1]) {
    auto res = m.inverse() * v;
    cout << fixed << setprecision(3) << res[0] << " " << fixed << setprecision(3) << res[1] << endl;
  }
}

C++: #include <stdio.h>

int main(){
	int a,b,c,d,e,f;
	double x,y;
	while(scanf("%d %d %d %d %d %d", &a, &b, &c, &d, &e, &f) != EOF){
		x = ((double)e*(double)c-(double)b*(double)f)/((double)e*(double)a-(double)b*d);
		y = ((double)d*(double)c-(double)a*(double)f)/((double)b*(double)d-(double)a*e);
		if(-0.005 < x && x < 0.005) x = 0;
		if(-0.005 < y && y < 0.005) y = 0;
		printf("%.3f %.3f\n", x, y);
	}
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <cstring>
#include <climits>
#include <queue>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define EPS 1e-6

int main(){
	int a,b,c,d,e,f;
	while(~scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f)){
		int p = c*e - b*f;
		int q = a*e - b*d;
		double x,y;
		
		//printf("p:%d  , q:%d\n",p,q);
		if( q!=0 ){
			x = (double)abs(p) / (double)abs(q);
			if( p<0&&q>0 || p>0&&q<0 ) x *= -1;
		}else{
			puts("???");
		}
		if( e!=0 ){
			y = (double)( f - d*x ) / (double)e + EPS;
		}else{
			puts("???????");
		}
		printf("%.3lf %.3lf\n",x,y);
	}
	return 0;
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;
typedef long long ll;
#define FOR(i,n) for(i=0;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	double a,b,c,d,e,f;
	for(;scanf("%lf %lf %lf %lf %lf %lf",&a,&b,&c,&d,&e,&f)!=EOF;){
		printf("%.3f %.3f\n",(c*e-f*b)/(a*e-d*b),(c*d-f*a)/(b*d-e*a));
	}
	return 0;
}

C++: #include <stdio.h>
#include<string>
#include<string.h>
#include <math.h>
#include<iostream>
#include <algorithm>
#include <map>
#include <vector>
#include <queue>
using namespace  std;


/*
//my header
#include "define.h"
#include "geometry.h"*/

#define MyAbs(a) ((a)>0?(a):-(a))
#define MyEqualDoule(a,b) (MyAbs(a-b)<1e-6)

void init()
{
#ifdef _WIN32
	freopen("1.txt", "r", stdin);
#endif
}

void func();

int main()
{
	init();
	func();

	return 0;
}


void func()
{
	double a,b,c,d,e,f, x, y;
	while(~scanf("%lf%lf%lf%lf%lf%lf", &a, &b, &c, &d, &e, &f))
	{
		if(MyEqualDoule(a*e-b*d,0))
			x = 0;
		else
			x = (c*e-f*b)/(a*e - b*d);

		if(MyEqualDoule(b*d - a*e),0)
			y = 0;
		else
			y = (c*d-a*f)/(b*d - a*e);
		printf("%.3lf %.3lf\n", x, y);
	}
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/

#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	double a, b, p, c, d, q;
	double x, y;

	while (cin >> a >> b >> p >> c >> d >> q)
	{
		x = (p*d - b*q) / (a*d - b*c);
		y = (a*q - p*c) / (a*d - b*c);
		
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}