#include<iostream>
#include<stdio.h>
#include<unistd.h>
#include<sys/wait.h>
#include<cstdlib>
using namespace std;
int main (void) {
       int pid ;
       for (int i=0;i<3;i++) {
           pid=fork();
           if (pid==0) break;
       }
       if (pid==0) {
            cout << "Child:" <<getpid()%getppid() <<endl;
       } else {
             cout<< "Parent:" <<getpid() <<endl;
             
             for (int i=0;i<3;i++) {
               wait(NULL);
      }
       }
    return 0;
}
