JavaScript
b='';
prompt=function(){return eval("b");};
alert=function(x){console.log(x);};
function test1(x) {
b=x;
a=prompt(o=[]).slice(1,-1).split(",");
for(i=a.length;i+1;i--)
for(j=i-1;j+1;a[j]=~~a[j--])
if(a[i]+a[j]==10)
{
o.push("("+a[j]+","+a[i]+")");
a.splice(i,1);
a.splice(j,1);
}
alert("("+o+")");
}
function test2(x) {
b=x;
a=prompt(u=[],o=[]).slice(1,-1).split(',');
for(i=0;k=a[++i]|=0;)
for(j=i;p=a[--j];)
k+p-10||u[i]||u[j]||o.push("("+(u[j]=u[i]=p)+","+k+")");
alert("("+o+")");
}
//(1,2,3,4,5,5,6,7) =((4,6),(5,5),(3,7))
//(1,2,3,4,5) = ()
//(5,5,5,5,5) = ((5,5),(5,5))
//(1,2,3,3,4,5,6,7)=((3,7),(4,6))
//(9,8,7,6,4,4,3,1)=((9,1),(7,3),(6,4))
//console.log(new Array(70).join('\n'));
test=test2;
test("(1,2,3,4,5,5,6,7)");
test("(1,2,3,4,5)");
test("(5,5,5,5,5)");
test("(1,2,3,3,4,5,6,7)");
test("(9,8,7,6,4,4,3,1)");