#include <iostream> 
#include <string>      
using namespace std;

class MyShape
{
	public:
		void X()
		{
			cout << "MyShape" << endl;
		}
};
class MyRectangle : public MyShape
{
	public:
		void Y()
		{
			cout << "MyRectangle" << endl;
		}
};
class MySquare : public MyRectangle
{
public:
	void Z()
	{
		cout << "MySquare" << endl;
	}
};

int main()
{
	MyRectangle R1;
	R1.X();
	R1.Y();

	MySquare S1;
	S1.X();
	S1.Y();
	S1.Z();
}

