#include <stdio.h>
#include <ctype.h>
#include <math.h>
#include <assert.h>

/* Calculate minimal and maximal areas of various figures */
enum figure_tag 
{
  CIRCLE,
  RECTANGLE,
  TRIANGLE, 
  LAST_FIGURE
};

struct point
{
  double x, y;
};

struct fcircle 
{
  struct point center;
  double radius;
};

struct frectangle
{
  struct point ll, ur;
};

struct ftriangle
{
  struct point a, b, c;
};

struct figure
{
  enum figure_tag tag;
  union {
    struct fcircle fc;
    struct frectangle fr;
    struct ftriangle ft;
  } u;
};

struct farea
{
  double min, max;
  int initialized : 1;
};

static int read_figure (struct figure *f)
{
  char name;

  if (scanf (" %c", &name) != 1)
    return 0;

  switch (toupper (name)) {
    case 'C': 
      f->tag = CIRCLE; 
      break;
    case 'R': 
      f->tag = RECTANGLE; 
      break;
    case 'T': 
      f->tag = TRIANGLE; 
      break;
    default: 
      return 0;
  } 

  switch (f->tag) {
    case CIRCLE: 
      if (scanf ("%lf%lf%lf", &f->u.fc.center.x, &f->u.fc.center.y, 
	  &f->u.fc.radius) != 3)
	return 0;
      break;	 
    case RECTANGLE: 
      if (scanf ("%lf%lf%lf%lf", &f->u.fr.ll.x, &f->u.fr.ll.y,
    	  &f->u.fr.ur.x, &f->u.fr.ur.y) != 4)
	return 0;
      break;
    case TRIANGLE: 
      if (scanf ("%lf%lf%lf%lf%lf%lf", &f->u.ft.a.x, &f->u.ft.a.y,
	  &f->u.ft.b.x, &f->u.ft.b.y, &f->u.ft.c.x, &f->u.ft.c.y) != 6)
	return 0;
      break;
  }
  return 1;
}

static void output_minmax_areas (enum figure_tag ft, struct farea *fa)
{
  static char *fnames[LAST_FIGURE] = {"CIRCLE", "RECTANGLE", "TRIANGLE"};

  if (!fa->initialized)
    printf ("No figures of type %s were met\n", fnames[ft]);
  else {
    printf ("Minimal area of %s(s): %.5f\n", fnames[ft], fa->min);
    printf ("Maximal area of %s(s): %.5f\n", fnames[ft], fa->max);
  }
}

static double calculate_area (struct figure *f)
{
  double a = 0.0;

  switch (f->tag) {
    case CIRCLE: 
      a = f->u.fc.radius * f->u.fc.radius * M_PI;
      break;
    case RECTANGLE: 
      a = fabs ((f->u.fr.ll.x - f->u.fr.ur.x) * (f->u.fr.ll.y - f->u.fr.ur.y));
      break; 
    case TRIANGLE: {
      double x1, y1, x2, y2;

      x1 = f->u.ft.b.x - f->u.ft.a.x;
      y1 = f->u.ft.b.y - f->u.ft.a.y;
      x2 = f->u.ft.c.x - f->u.ft.a.x;
      y2 = f->u.ft.c.y - f->u.ft.a.y;
      a = fabs (x1 * y2 - x2 * y1) / 2;
      break;
    }
    default: 
      assert (0);
  }
  return a;
}

static void calculate_minmax_areas (enum figure_tag tag, struct figure *f, 
				    struct farea *fa)
{
  for (; f->tag != LAST_FIGURE; f++)
    if (f->tag == tag) {
      double a = calculate_area (f);

      if (!fa->initialized) {
        fa->min = fa->max = a;
        fa->initialized = 1;
      } else {
        if (a < fa->min)
  	  fa->min = a;
        if (a > fa->max)
	  fa->max = a;
      }
    }
}

int main (void)
{
  enum { MAXFIG = 128 };
  struct figure figs[MAXFIG + 1];
  struct farea areas[LAST_FIGURE];
  int i = 0;

  while (i < MAXFIG)
    if (!read_figure (&figs[i]))
      break;
    else
      i++;
  
  if (i == 0)
    return 1;  
  
  figs[i].tag = LAST_FIGURE;
  for (i = CIRCLE; i < LAST_FIGURE; i++) {
    areas[i].initialized = 0;
    calculate_minmax_areas (i, figs, &areas[i]);
    output_minmax_areas (i, &areas[i]);
  }
  return 0;
}
