#include <mpc.h>

#define N 6

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

int [net Mesh(m,n) w] My_Barrier( void ) {
  int [w:parent]bs[m*n], [w]b=1;
  bs[] = b;
  b = bs[];
}

int [*]main() {
  net SimpleNet(N) mynet;
  int [mynet]my_coordinate;
  
  my_coordinate = I coordof mynet;
  if(my_coordinate%2==0)
    [mynet]MPC_Printf("Hello, even world!\n");

  ([(1,N)mynet])My_Barrier();

  if(my_coordinate%2==1)
    [mynet]MPC_Printf("Hello, odd world!\n");
}