#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

void fork0()
{
    fork();
    if (fork() == 0) {
        sleep(2);
        printf("child\n");
        exit(0);
    }
}


void wait0()
{
    int pid;

    while ((pid = wait(NULL)) != -1)
        printf("%d\n", pid);
}

int main()
{
    fork0();
    wait0();
    return 0;
}
