#include <iostream>
#include <string>
#include <cmath>

#define PI 3.14

using namespace std;

class Figure {
  protected:
    string name;
};

// no modifications allowed below to a comment

class Circle: public Figure {
  public:
    Circle(float radius = 0) :
          radius(radius) { this->name = "circle"; }
    float area() const;
  protected:
    float radius;
};

class Triangle: public Figure {
  public:
    Triangle(float base = 0, float height = 0) :
          base(base), height(height) { this->name = "triangle"; }
    float area() const;
  protected:
    float base, height;
};

class Rectangle: public Figure {
  public:
    Rectangle(float width = 0, float height = 0) :
          width(width), height(height) { this->name = "rectangle"; }
    float area() const;
  protected:
    float width, height;
};

class Square: public Rectangle {
  public:
    Square(float side = 0) :
          Rectangle(side, side) { this->name = "square"; }
};


float Circle::area() const {
    return PI * this->radius * this->radius;
}

float Triangle::area() const {
    return this->base * this->height / 2;
}

float Rectangle::area() const {
    return this->width * this->height;
}

ostream &operator<<(ostream &s, const Figure &f) {
    s << f.getName();

    return s;
}

// no modifications allowed above to a comment

figures[8];

// no modifications allowed below this line

int main() {

    figures[0] = new Circle(1);
    figures[1] = new Circle(2);
    figures[2] = new Triangle(2, 3);
    figures[3] = new Triangle(3, 4);
    figures[4] = new Rectangle(2, 3);
    figures[5] = new Rectangle(3, 4);
    figures[6] = new Square(3);
    figures[7] = new Square(5);

    for (int i = 0; i < 8; i++) {
        figures[i]->info();
    }

    for (int i = 0; i < 8; i++) {
        delete figures[i];
    }

    return 0;
}
