#include <iostream>
using namespace std;
class A
{
public:
void print() const { cout << "A" << endl; }
};
class B : public A
{
public:
void print() const { cout << "B" << endl; }
};
class C
{
public:
virtual void print() const { cout << "C" << endl; }
};
class D : public C
{
public:
void print() const { cout << "D" << endl; }
};
int main() {
A* a = new B;
a->print();
C* c = new D;
c->print();
// your code goes here
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY2xhc3MgQQp7CnB1YmxpYzoKCXZvaWQgcHJpbnQoKSBjb25zdCB7IGNvdXQgPDwgIkEiIDw8IGVuZGw7IH0KfTsKCmNsYXNzIEIgOiBwdWJsaWMgQQp7CnB1YmxpYzoKCXZvaWQgcHJpbnQoKSBjb25zdCB7IGNvdXQgPDwgIkIiIDw8IGVuZGw7IH0KfTsKCmNsYXNzIEMKewpwdWJsaWM6Cgl2aXJ0dWFsIHZvaWQgcHJpbnQoKSBjb25zdCB7IGNvdXQgPDwgIkMiIDw8IGVuZGw7IH0KfTsKCmNsYXNzIEQgOiBwdWJsaWMgQwp7CnB1YmxpYzoKCXZvaWQgcHJpbnQoKSBjb25zdCB7IGNvdXQgPDwgIkQiIDw8IGVuZGw7IH0KfTsKCgppbnQgbWFpbigpIHsKCUEqIGEgPSBuZXcgQjsKCWEtPnByaW50KCk7CgkKCUMqIGMgPSBuZXcgRDsKCWMtPnByaW50KCk7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglyZXR1cm4gMDsKfQ==