import java.util.ArrayList;
import java.util.Scanner;
import java.awt.geom.Point2D;

// Based on sample code from ICPC Challenge site
// Refactored a bit by mike slattery
// Add a random touch

public class EightB {
  /** Simple representation for a puck. */
  static class Puck {
    // Position of the puck.
    Point2D pos;

    // Puck velocity
    Point2D vel;

    // Puck color
    int color;
  };

  /** Representation for a bumper. */
  static class Bumper {
    // Position of the bumper.
    Point2D pos;

    // Bumper velocity
    Point2D vel;

    // add state variables for chasing a puck
    int puckNumber = -1;
    int timer = 0; // timer <= 0 means not currently busy
    Point2D destination = new Point2D.Double(0, 0);

    public int getTimer()
    {
		return timer;
	}

	public void setTimer(int t)
	{
		timer = t;
	}

	public void countDown()
	{
		timer--;
	}

	public int getPuckNumber()
	{
		return puckNumber;
	}

    public void setPuckNumber(int n)
    {
		puckNumber = n;
	}

	public Point2D getDestination()
	{
		return destination;
	}

	public void setDestination(Point2D d)
	{
		destination = d;
	}
  };

  /** Simple representation for a sled. */
  static class Sled {
    // Position of the sled.
    Point2D pos;

    // Sled direction.
    double dir;
  };

  /** How much acceleration we are willing to spend on each component. */
  private static final double ACCEL = Const.BUMPER_ACCEL_LIMIT / Math.sqrt( 2 );

  /** Return the value of a, clamped to the [ b, c ] range */
  private static double clamp( double a, double b, double c ) {
    if ( a < b )
      return b;
    if ( a > c )
      return c;
    return a;
  }

  /** Return a new vector containing the sum of a and b. */
  static Point2D sum( Point2D a, Point2D b ) {
    return new Point2D.Double( a.getX() + b.getX(),
                               a.getY() + b.getY() );
  }

  /** Return a new vector containing the difference between a and b. */
  static Point2D diff( Point2D a, Point2D b ) {
    return new Point2D.Double( a.getX() - b.getX(),
                               a.getY() - b.getY() );
  }

  /** Return a new vector containing a scaled by scaling factor s. */
  static Point2D scale( Point2D a, double s ) {
    return new Point2D.Double( a.getX() * s, a.getY() * s );
  }

  /** Return the magnitude of vector a. */
  static double mag( Point2D a ) {
    return Math.sqrt( a.getX() * a.getX() + a.getY() * a.getY() );
  }

  /** Return a new vector containing normalized version of a. */
  static Point2D norm( Point2D a ) {
    double m = mag( a );
    return new Point2D.Double( a.getX() / m,
                               a.getY() / m );
  }

  /** Return a ccw perpendicular vector for a. */
  static Point2D perp( Point2D a ) {
    return new Point2D.Double( -a.getY(), a.getX() );
  }

  /** Return the dot product of a and b. */
  static double dot( Point2D a, Point2D b ) {
    return a.getX() * b.getX() + a.getY() * b.getY();
  }

  /** Return the cross product of a and b. */
  static double cross( Point2D a, Point2D b ) {
    return a.getX() * b.getY() - a.getY() * b.getX();
  }

  /** One dimensional function to help compute acceleration vectors. Return an
      acceleration that can be applied to a bumper at pos and moving
      with velocity vel to get it to target.  The alim parameter puts
      a limit on the acceleration available. */
  private static double moveTo( double pos, double vel, double target,
                                double alim ) {
    // Compute how far pos has to go to hit target.
    double dist = target - pos;

    // Kill velocity if we are close enough.
    if ( Math.abs( dist ) < 0.01 )
      return clamp( -vel, -alim, alim );

    // How many steps, at minimum, would cover the remaining distance
    // and then stop.
    double steps = Math.ceil(( -1 + Math.sqrt(1 + 8.0 * Math.abs(dist) / alim))
                             / 2.0);
    if ( steps < 1 )
      steps = 1;

    // How much acceleration would we need to apply at each step to
    // cover dist.
    double accel = 2 * dist / ( ( steps + 1 ) * steps );

    // Ideally, how fast would we be going now
    double ivel = accel * steps;

    // Return the best change in velocity to get vel to ivel.
    return clamp( ivel - vel, -alim, alim );
  }

  public static int findTarget(Bumper bumper, int puckColor, Point2D tdest)
  {
  	// Find a target of color puckColor and close to the bumper
  	// and not too close to tdest (our intent is to push this
  	// puck toward tdest).
  	// Return -1 if not found
	int target = -1;
	for ( int j = 0; j < plist.size(); j++ ) {
	  if ( plist.get( j ).color == puckColor &&
		   plist.get( j ).pos.distance( tdest ) > 120 &&
		   Math.abs( plist.get( j ).pos.getX() - 400 ) < 340 &&
		   Math.abs( plist.get( j ).pos.getY() - 400 ) < 340 &&
		   ( target < 0 ||
			 plist.get( j ).pos.distance( bumper.pos ) <
			 plist.get( target ).pos.distance( bumper.pos ) ) )
	  target = j;
    }
	return target;
  }

  public static Point2D computeBumperMove(Bumper bumper)
  {
	    // Compute an acceleration vector for the bumper
	    // which will contribute to pushing the puck
	    // toward tdest.

		// Where's the target.
		Point2D tpos = plist.get( bumper.getPuckNumber() ).pos;

		// Split the bumper's velocity into components toward the puck
		// and perp.
		double dist = tpos.distance( bumper.pos );
		Point2D a1 = scale( diff( tpos, bumper.pos ), 1.0 / dist );
		Point2D a2 = perp( a1 );

		// Represent the velocity WRT a target-centric frame.
		double v1 = dot( a1, bumper.vel );
		double v2 = dot( a2, bumper.vel );

		// compute force in this frame.
		double f1 = 0;
		double f2 = 0;

		// Direction from the puck to where we want to hit it.
		Point2D tdir = diff( bumper.getDestination(), tpos );

		// Should we move around the target puck?
		double dprod = dot( a1, norm( tdir ) );
		if ( dprod < 0.8 ) {
		  // Try to maintain a moderate distance to the target.
		  if ( dist > 80 ) {
			f1 = ACCEL;
		  } else if ( dist < 40 ) {
			f1 = -ACCEL;
		  } else {
			f1 = clamp( -v1, -ACCEL, ACCEL );
		  }

		  // How far around do we have to around the target.
		  double cdist = Math.acos( dprod ) * dist;
		  // Move around the shorter way.
		  if ( cross( tdir, a1 ) > 0 ) {
			f2 = ACCEL;
		  } else {
			f2 = -ACCEL;
		  }
		} else {
		  // Consider the velocity WRT a frame that points from the target
		  // puck to the destination
		  a1 = norm( tdir );
		  a2 = perp( a1 );

		  v1 = dot( a1, bumper.vel );
		  v2 = dot( a2, bumper.vel );

		  // Position of the bumper WRT the target puck and a frame pointing
		  // to the target's destination.
		  Point2D bdisp = diff( bumper.pos, tpos );
		  double p1 = dot( a1, bdisp );
		  double p2 = dot( a2, bdisp );

		  // How hard do we have to hit the target to get it to the
		  // destination.
		  double tdist = mag( tdir );

		  double a = 0.5;
		  double b = 0.5;
		  double c = -tdist;

		  // Number of steps the puck has to take to cover mag tdist.
		  // Actually, steps seems to be the initial velocity required
		  // for a puck to travel tdist units.
		  double steps = ( -b + Math.sqrt( b * b - 4 * a * c ) ) / ( 2 * a );

		  // Approximate velocity to get the puck to travel to its
		  // destination.
		  // Here I would expect to allow for the differing mass
		  // between the bumper and puck.
		  double vel = steps * 0.7;

		  // Match desired velocity in the direction we want to move the puck,
		  // line up on the other axis.
		  f1 = clamp( vel - v1, -ACCEL, ACCEL );
		  f2 = moveTo( p2, v2, 0.0, ACCEL );

		  // If we are about to hit the target, pick a new
		  // one the next turn.
		  if ( p1 + v1 + f1 > -13 )
			bumper.setTimer(1);
		}

		Point2D force = sum( scale( a1, f1 ), scale( a2, f2 ) );
		return force;
  }
    // Current puck info.
	// Make global for getPuckNumber and computeBumperMove
    static ArrayList< Puck > plist = new ArrayList< Puck >();


  public static void main( String[] arg ) {
    // List of current sled and bumper info

    ArrayList< Bumper > blist = new ArrayList< Bumper >();
    ArrayList< Sled > slist = new ArrayList< Sled >();

    Scanner in = new Scanner( System.in );

    int moveCount = 0;
    int sledCount = 0;
    boolean sledLeft = false;
    int sledTurn = 40;
    // Set up bumper objects to reuse below
    for (int i = 0; i < 4; i++)
    	blist.add(new Bumper());

    // Keep reading states until the game ends.
    int tnum = in.nextInt();
    while ( tnum >= 0 ) {
      // Read all the pucks
      int n = in.nextInt();
      plist.clear();
      for ( int i = 0; i < n; i++ ) {
        Puck p = new Puck();
        double x = in.nextDouble();
        double y = in.nextDouble();
        p.pos = new Point2D.Double( x, y );
        x = in.nextDouble();
        y = in.nextDouble();
        p.vel = new Point2D.Double( x, y );
        p.color = in.nextInt();
        plist.add( p );
      }

      // Read all the bumpers
      n = in.nextInt();
      //System.err.println("Bumper count = "+n);
      // Just reset pos, vel to retain other data
      for ( int i = 0; i < n; i++ ) {
        Bumper b = blist.get(i);
        double x = in.nextDouble();
        double y = in.nextDouble();
        b.pos = new Point2D.Double( x, y );
        x = in.nextDouble();
        y = in.nextDouble();
        b.vel = new Point2D.Double( x, y );
      }

      // Read the sleds and their trails.
      n = in.nextInt();
      slist.clear();
      for ( int i = 0; i < n; i++ ) {
        // Read the state of the sled.
        Sled s = new Sled();
        double x = in.nextDouble();
        double y = in.nextDouble();
        s.pos = new Point2D.Double( x, y );
        s.dir = in.nextDouble();
        slist.add( s );

        // Just throw away the trail information.
        int ts = in.nextInt();
        for ( int j = 0; j < ts; j++ ) {
          in.nextDouble();
          in.nextDouble();
        }
      }

      // Just make each bumper run toward the nearest grey puck.
      for ( int i = 0; i < 2; i++ ) {
		Bumper bumper = blist.get( i );

        // Where does this bumper try to send the pucks?
        Point2D tdest = new Point2D.Double( 100, i == 0 ? 300 : 500 );
		bumper.setDestination(tdest);

		// If this bumper isn't busy, find a puck for it
		if ( bumper.getTimer() <= 0 ) {
			int p = findTarget(bumper, Const.GREY, tdest);
			// If no "good" puck was found, just take the first one
			if (p < 0)
				p = 0;
			bumper.setPuckNumber(p);
			bumper.setTimer(20);
			//System.err.println("New puck");
		}

		Point2D force = computeBumperMove(bumper);
		// Tell the game what direction we want to move this bumper.
		System.out.printf( "%.2f %.2f ", force.getX(), force.getY() );

		// Count down for how long we can chase this target.
		bumper.countDown();
		//System.err.println("Bumper move at time "+bumper.getTimer());
      }

      // Make the sled drive in a figure eight.
      /*
      if ( moveCount % 80 < 40 ) {
        System.out.printf( "%.6f\n", Math.PI * 2.0 / 40 );
      } else {
        System.out.printf( "%.6f\n", -Math.PI * 2.0 / 40 );
      }*/

      if (sledCount <= 0)
      {
		  sledTurn = 30 + (int)(Math.random()*14);
		  sledCount = sledTurn;
		  sledLeft = !sledLeft;
	  }
	  if (sledLeft)
	  {
		  System.out.printf( "%.6f\n", Math.PI * 2.0 / sledTurn );
	  } else {
		  System.out.printf( "%.6f\n", -Math.PI * 2.0 / sledTurn );
	  }

      // Try to read the next game state.
      tnum = in.nextInt();
      moveCount++;
      sledCount--;
    }
  }
}

