#include <iostream>
using namespace std;

class pr2;

class pr1 {
	int printing;
public:
	pr1(){printing = 0;}
	void set_print(int status){printing = status;}
	friend bool inuse(pr1 p1, pr2 p2);
};

class pr2 {
	int printing;
public:
	pr2(){printing = 0;}
	void set_print(int status){printing = status;}
	friend bool inuse(pr1 p1, pr2 p2);
};

bool inuse(pr1 p1,pr2 p2)
{
	return !(p1.printing == 0) || !(p2.printing == 0);
}

int main()
{
	pr1 p1;
	pr2 p2;
	cout << inuse(p1,p2) << "\n";
	p1.set_print(1);
	cout << inuse(p1,p2) << "\n";
	p2.set_print(1);
	cout << inuse(p1,p2) << "\n";
	p1.set_print(0);
	cout << inuse(p1,p2) << "\n";
	p2.set_print(0);
	cout << inuse(p1,p2) << "\n";
	
	return 0;
}