a = vector(199);
nxt = vector(2);

{
	print ("0 0");
	r=1;
	d=1;
	k=0;
	for (n=1, 10 000,
		print (n " " v = nxt[1+r%2]+=d);
		if (n<=#a,
			a[n]=v;
		);
		k++;
		if (k==abs(a[r]),
			k=0;
			r++;
			d=-d;
			if (r>#a,
				break;
			);
		);
	);
}

quit