#include <mpc.h>

nettype TrivialNet(int n, int m) {
  coord I=n;
  parent [m];
};

int [*]main() {
  [host]MPC_Printf("I'm host. I'll be a parent of net1.\n\n");
  {
    net TrivialNet(3,0) net1;
    int [net1]mycoordinnet1;

    mycoordinnet1 = I coordof net1;
  [net1]:
    if(mycoordinnet1)
      MPC_Printf("I'm a regular member of net1. "
                 "My coordinate in net1 is %d.\n"
                 " I'll be a parent of net%d.\n\n",
                  mycoordinnet1, mycoordinnet1+1);
    else
      MPC_Printf("I'm a parent of net1. "
                   "My coordinate in net1 is %d.\n\n", mycoordinnet1);
    {
        net TrivialNet(3,1) [net1:I==1]net2;
        net TrivialNet(3,2) [net1:I==2]net3;

        [net2]: {
          int mycoordinnet2;
          mycoordinnet2 = I coordof net2;
          if(mycoordinnet2!=1)
            MPC_Printf("I'm a regular member of net2. "
                       "My coordinate in net2 is %d.\n\n",
                        mycoordinnet2);
          else
            MPC_Printf("I'm a parent of net2. "
                       "My coordinate in net2 is %d.\n\n",
                       mycoordinnet2);
        }
        [net3]: {
          int mycoordinnet3;
          mycoordinnet3 = I coordof net3;
          if(mycoordinnet3!=2)
            MPC_Printf("I'm a regular member of net3. "
                       "My coordinate in net3 is %d.\n\n",
                        mycoordinnet3);
          else
            MPC_Printf("I'm a parent of net3. "
                       "My coordinate in net3 is %d.\n\n",
                       mycoordinnet3);
        }
    }
  [net1]:
    if(mycoordinnet1)
      MPC_Printf("I'm a regular member of net1. "
                 "My coordinate in net1 is %d.\n"
                 " I was a parent of net%d.\n\n",
                 mycoordinnet1, mycoordinnet1+1);
  }
  [host]MPC_Printf("I'm host. I was a parent of net1.\n\n");
}