	distribute( )
	{int i, hbot, s;
	typekey lastout;

	for (i=0; i<M; i++) {
		Buff[i] = ReadFile( 1 );
		if ( Eof(1) ) break;
		}
	i--;

	while (i>=0) {
		for (hbot=0; hbot<i; )	insert( ++hbot, Buff );
		/*** Start a new sequence ***/
		s = nextfile();
		while (hbot >= 0) {
			lastout = Buff[0].k;
			WriteFile( s, Buff[0] );
			Buff[0] = Buff[hbot];
			siftup( Buff, 0, hbot-1 );
			if ( !Eof(1) )	Buff[hbot] = ReadFile(1);
			if ( Eof(1) ) 	Buff[hbot--] = Buff[i--];
			else if ( Buff[hbot].k < lastout )  hbot--;
				else	insert( hbot, Buff );
			}
		}
	};
