#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define FL 0
#define FR 1
#define HL 2
#define HR 3

#define XX 0
#define YY 1
#define ZZ 2

main()
{
  char buffer[1000];
  int i;
  float array[1000];
  float steps[1000][4][3];
  int step = -1;
  int touchdownleg[1000];
  int n_steps = -1;

  for( ; ; )
    {
      if ( scanf( "%s", buffer ) < 1 )
	break;
      if ( strcmp( "point", buffer ) == 0 )
	continue;
      if ( strcmp( "bodypos", buffer ) == 0 )
	{
	  for( i = 0; i < 3; i++ )
	    scanf( "%g", &(array[i]) );
	  continue;
	}
      if ( strcmp( "bodyorient", buffer ) == 0 )
	{
	  for( i = 0; i < 4; i++ )
	    scanf( "%g", &(array[i]) );
	  continue;
	}
      if ( strcmp( "compos", buffer ) == 0 )
	{
	  for( i = 0; i < 3; i++ )
	    scanf( "%g", &(array[i]) );
	  continue;
	}
      if ( strcmp( "touchdownleg", buffer ) == 0 )
	{
	  step++;
	  n_steps = step + 1;
	  for( i = 0; i < 1; i++ )
	    scanf( "%d", &(touchdownleg[step]) );
	  continue;
	}
      if ( strcmp( "FL", buffer ) == 0 )
	{
	  for( i = 0; i < 3; i++ )
	    scanf( "%g", &(steps[step][FL][i]) );
	  continue;
	}
      if ( strcmp( "FR", buffer ) == 0 )
	{
	  for( i = 0; i < 3; i++ )
	    scanf( "%g", &(steps[step][FR][i]) );
	  continue;
	}
      if ( strcmp( "HL", buffer ) == 0 )
	{
	  for( i = 0; i < 3; i++ )
	    scanf( "%g", &(steps[step][HL][i]) );
	  continue;
	}
      if ( strcmp( "HR", buffer ) == 0 )
	{
	  for( i = 0; i < 3; i++ )
	    scanf( "%g", &(steps[step][HR][i]) );
	  continue;
	}
      fprintf( stderr, "Unknown keyword %s in input.\n", buffer );
      exit( -1 );
    }

  printf( "FL:\n" );
  if ( touchdownleg[0] < 0 )
    printf( "%g %g\n", steps[0][FL][XX],
	    steps[0][FL][YY] );
  for( step = 0; step < n_steps; step++ )
    {
      if ( touchdownleg[step] == FL )
	printf( "%g %g\n", steps[step][FL][XX],
		steps[step][FL][YY] );
    }

  printf( "FR:\n" );
  if ( touchdownleg[0] < 0 )
    printf( "%g %g\n", steps[0][FR][XX],
	    steps[0][FR][YY] );
  for( step = 0; step < n_steps; step++ )
    {
      if ( touchdownleg[step] == FR )
	printf( "%g %g\n", steps[step][FR][XX],
		steps[step][FR][YY] );
    }

  printf( "HL:\n" );
  if ( touchdownleg[0] < 0 )
    printf( "%g %g\n", steps[0][HL][XX],
	    steps[0][HL][YY] );
  for( step = 0; step < n_steps; step++ )
    {
      if ( touchdownleg[step] == HL )
	printf( "%g %g\n", steps[step][HL][XX],
		steps[step][HL][YY] );
    }

  printf( "HR:\n" );
  if ( touchdownleg[0] < 0 )
    printf( "%g %g\n", steps[0][HR][XX],
	    steps[0][HR][YY] );
  for( step = 0; step < n_steps; step++ )
    {
      if ( touchdownleg[step] == HR )
	printf( "%g %g\n", steps[step][HR][XX],
		steps[step][HR][YY] );
    }
}
