#include <iostream>
#include <unistd.h>
using namespace std;

int main() {
	pid_t pid=fork();
	if (pid==0) {
		cout <<"Child parent= " << getppid() << "\n";
		sleep(20);
		cout <<"Child adopted by PID:" <<getppid(0<<"\n";
		sleep(1);
	} else {
		cout <<"Parent exits \n";
		sleep(3);
		_exit(0);
	}
	return 0;
}
