the first thing is, that you sometimes just use 1 index and sometimes 2...
 Code:
balls[n] =....

balls[n][1] =....


I think you should use 0 and 1 as indices and not 1 and 2...

 Code:
balls[n][1] = my.x;
balls[n][2] = my.y;
>>>>>>
balls[n][0] = my.x;
balls[n][1] = my.y;