#include <iostream>
class A {
public :
A( ) ;
~A( ) ;
void hello( const char * message) ;
static A a;
} ;
class B {
public :
B( ) ;
~B( ) ;
void hello( const char * message) ;
static B b;
} ;
A:: A ( ) {
std:: cout << "A() is constructed\n " ;
B:: b .hello ( "constructur A()" ) ;
}
A:: ~A( ) {
std:: cout << "A() is destructed\n " ;
B:: b .hello ( "destructor A()" ) ;
}
void A:: hello ( const char * message) {
std:: cout << "Hello from A! (" << message << ")\n " ;
} ;
A A:: a ;
B:: B ( ) {
std:: cout << "B() is constructed\n " ;
A:: a .hello ( "constructor B()" ) ;
}
B:: ~B( ) {
std:: cout << "B() is destructed\n " ;
A:: a .hello ( "destructor B()" ) ;
}
void B:: hello ( const char * message) {
std:: cout << "Hello from B! (" << message << ")\n " ;
} ;
B B:: b ;
int main( ) {
}
I2luY2x1ZGUgPGlvc3RyZWFtPgogCmNsYXNzIEEgewogcHVibGljOgogICBBKCk7CiAgIH5BKCk7CiAgIHZvaWQgaGVsbG8oY29uc3QgY2hhciogbWVzc2FnZSk7CiAgIHN0YXRpYyBBIGE7Cn07CgpjbGFzcyBCIHsKIHB1YmxpYzoKICAgQigpOwogICB+QigpOwogICB2b2lkIGhlbGxvKGNvbnN0IGNoYXIqIG1lc3NhZ2UpOwogICBzdGF0aWMgQiBiOwp9OwoKQTo6QSgpIHsKICBzdGQ6OmNvdXQgPDwgIkEoKSBpcyBjb25zdHJ1Y3RlZFxuIjsKICBCOjpiLmhlbGxvKCJjb25zdHJ1Y3R1ciBBKCkiKTsKfQoKQTo6fkEoKSB7CiAgc3RkOjpjb3V0IDw8ICJBKCkgaXMgZGVzdHJ1Y3RlZFxuIjsKICBCOjpiLmhlbGxvKCJkZXN0cnVjdG9yIEEoKSIpOwp9Cgp2b2lkIEE6OmhlbGxvKGNvbnN0IGNoYXIqIG1lc3NhZ2UpIHsKICBzdGQ6OmNvdXQgPDwgIkhlbGxvIGZyb20gQSEgKCIgPDwgbWVzc2FnZSA8PCAiKVxuIjsKfTsK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