#include <iostream>
using std::cout;
using std::endl;
struct A
{
virtual void foo()
{
cout << "A" << endl;
}
A(){ }
};
struct B : A
{
B();
virtual void foo()
{
cout << "B" << endl;
}
};
B b;
B::B()
{
b.foo();
foo();
}
struct C : B
{
virtual void foo()
{
cout << "C" << endl;
}
C() : B(){ }
};
C c;
int main(){ }
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgc3RkOjpjb3V0Owp1c2luZyBzdGQ6OmVuZGw7CgpzdHJ1Y3QgQQp7CiAgICB2aXJ0dWFsIHZvaWQgZm9vKCkKICAgIHsKICAgICAgICBjb3V0IDw8ICJBIiA8PCBlbmRsOwogICAgfQogICAgCiAgICBBKCl7IH0KfTsKCnN0cnVjdCBCIDogQQp7CiAgICBCKCk7CiAgICB2aXJ0dWFsIHZvaWQgZm9vKCkKICAgIHsKICAgICAgICBjb3V0IDw8ICJCIiA8PCBlbmRsOwogICAgfQp9OwpCIGI7CgpCOjpCKCkKewogICAgYi5mb28oKTsKICAgIGZvbygpOwp9ICAKCnN0cnVjdCBDIDogQgp7CiAgICB2aXJ0dWFsIHZvaWQgZm9vKCkKICAgIHsKICAgICAgICBjb3V0IDw8ICJDIiA8PCBlbmRsOwogICAgfQogICAgCiAgICBDKCkgOiBCKCl7IH0gICAgICAKfTsKCkMgYzsKCmludCBtYWluKCl7IH0=