#include <iostream>

using namespace std;

class small {

private:
    int first;
    int second;
    
public:
    small(int a, int b) {
	first = a;
	second = b;
    }
    
    int &get_max_first() {
	return first>=second ? first : second;
    }
    
    int &get_min_second() {
	return first<second ? first : second;
    }

};

class big {
    small *s1, *s2;
public:
    big() {
	s1 = new small(9,5);
	s2 = new small(7,2);
    }
    int print() {
	cout << s1->get_min_second() << endl;
	cout << s1->get_max_first() << endl;
	cout << s2->get_min_second() << endl;
	cout << s2->get_max_first() << endl;
	return 0;
    }
    int swap() {
	int temp;
	temp = s1->get_min_second();
	s1->get_min_second() = s2->get_min_second();
	s2->get_min_second() = temp;
	temp = s1->get_max_first();
	s1->get_max_first() = s2->get_max_first();
	s2->get_max_first() = temp;
	return 0;
    }
    int set_max(int a, int b) {
	s1->get_max_first() = a;
	s2->get_max_first() = b;
	return 0;
    }
};

int main() {

    big b;
    b.print();
    cout << "Swapping..." << endl;
    b.swap();
    b.print();
    cout << "Setting max values..." << endl;
    b.set_max(100,200);
    b.print();
    return 0;
    
}
