code: def dmp_qq_heu_gcd(f, g, u, K0):
      """
      Heuristic polynomial GCD in `Q[X]`.
  
      Returns ``(h, cff, cfg)`` such that ``a = gcd(f, g)``,
      ``cff = quo(f, h)``, and ``cfg = quo(g, h)``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, QQ
      >>> R, x,y, = ring("x,y", QQ)
  
      >>> f = QQ(1,4)*x**2 + x*y + y**2
      >>> g = QQ(1,2)*x**2 + x*y
  
      >>> R.dmp_qq_heu_gcd(f, g)
      (x + 2*y, 1/4*x + 1/2*y, 1/2*x)
  
      """
      result = _dmp_ff_trivial_gcd(f, g, u, K0)
  
      if result is not None:
          return result
  
      K1 = K0.get_ring()
  
      cf, f = dmp_clear_denoms(f, u, K0, K1)
      cg, g = dmp_clear_denoms(g, u, K0, K1)
  
      f = dmp_convert(f, u, K0, K1)
      g = dmp_convert(g, u, K0, K1)
  
      h, cff, cfg = dmp_zz_heu_gcd(f, g, u, K1)
  
      h = dmp_convert(h, u, K1, K0)
  
      c = dmp_ground_LC(h, u, K0)
      h = dmp_ground_monic(h, u, K0)
  
      cff = dmp_convert(cff, u, K1, K0)
      cfg = dmp_convert(cfg, u, K1, K0)
  
      cff = dmp_mul_ground(cff, K0.quo(c, cf), u, K0)
      cfg = dmp_mul_ground(cfg, K0.quo(c, cg), u, K0)
  
      return h, cff, cfg
  
imports: from sympy.polys.densearith import dup_sub_mul, dup_neg, dmp_neg, dmp_add, dmp_sub, dup_mul, dmp_mul, dmp_pow, dup_div, dmp_div, dup_rem, dup_quo, dmp_quo, dup_prem, dmp_prem, dup_mul_ground, dmp_mul_ground, dmp_mul_term, dup_quo_ground, dmp_quo_ground, dup_max_norm, dmp_max_norm
  from sympy.polys.densebasic import dup_strip, dmp_raise, dmp_zero, dmp_one, dmp_ground, dmp_one_p, dmp_zero_p, dmp_zeros, dup_degree, dmp_degree, dmp_degree_in, dup_LC, dmp_LC, dmp_ground_LC, dmp_multi_deflate, dmp_inflate, dup_convert, dmp_convert, dmp_apply_pairs
  from sympy.polys.densetools import dup_clear_denoms, dmp_clear_denoms, dup_diff, dmp_diff, dup_eval, dmp_eval, dmp_eval_in, dup_trunc, dmp_ground_trunc, dup_monic, dmp_ground_monic, dup_primitive, dmp_ground_primitive, dup_extract, dmp_ground_extract
  from sympy.polys.galoistools import gf_int, gf_crt
  from sympy.polys.polyconfig import query
  from sympy.polys.polyerrors import MultivariatePolynomialError, HeuristicGCDFailed, HomomorphismFailed, NotInvertible, DomainError
label_desc: Use image node_id 39 for calling a global function with example usage: dmp_qq_heu_gcd(f, g, u, K0) and returns: h,  cff,  cfg, result