#include <iostream>

using namespace std;

class A {
  public:
    virtual char f() { return 'A'; }
};
class B : public A {
  public:
    virtual char f() { return 'B'; }
};

int main() {
  B b; A& ap = b;
  cout << b.f() << ap.f() << endl;
}
