ary = []
formula3 = []
cc = 0

while ary = gets
  int_ary = ary.split(' ').map(&:to_i)
  formula1 = int_ary[0, 3]
  formula2 = int_ary[3, 3]

  if formula1[0] <= formula2[0]
    d = formula2[0]
    while (formula2[0] % formula1[0]) != 0
      formula2[0] += d;
    end
    least_common_multiple = formula2[0]
    v = least_common_multiple / formula1[0]
    a = formula1.map{ |n| n * v}
    formula3 = a
    cc = 0
  else
    d = formula1[0]
    while (formula1[0] % formula2[0]) != 0
      formula1[0] += d
    end
    b = formula2.map{ |n| n * formula1[0]}
    least_common_multiple = formula1[0]
    v = least_common_multiple / formula2[0]
    a = formula2.map{ |n| n * v}
    formula3 = a
    cc = 1
  end

  if cc == 0
    diff = formula3.zip(formula2).map{|i, j| i - j}
  else
    diff = formula3.zip(formula1).map{|i, j| i - j}
  end

  x = diff[1]
  ans = diff[2]
  r = ans / x
  formula1[1] = r * formula1[1]
  y = formula1[0]
  ans1 = formula1[2] - formula1[1]
  q = ans1 / y

  print sprintf "%.3f", q
  print " "
  print sprintf "%.3f", r
  print "\n"
end